Share via


DocumentSource Class

public final class DocumentSource
extends ContentSource

Represents a parsed document grounding source in the format D(page,x1,y1,x2,y2,x3,y3,x4,y4).

The page number is 1-based. The polygon is a quadrilateral defined by four points with coordinates in the document's coordinate space.

Method Summary

Modifier and Type Method and Description
RectangleF getBoundingBox()

Gets the axis-aligned bounding rectangle computed from the polygon coordinates.

int getPageNumber()

Gets the 1-based page number.

List<PointF> getPolygon()

Gets the polygon coordinates as four points defining a quadrilateral region.

static List<DocumentSource> parse(String source)

Parses a source string containing one or more document source segments separated by ;.

Methods inherited from ContentSource

equals getRawValue hashCode parseAll com.azure.ai.contentunderstanding.models.ContentSource.toRawString(java.util.List< toString

Methods inherited from java.lang.Object

Method Details

getBoundingBox

public RectangleF getBoundingBox()

Gets the axis-aligned bounding rectangle computed from the polygon coordinates. Useful for drawing highlight rectangles over extracted fields.

Returns:

The bounding box.

getPageNumber

public int getPageNumber()

Gets the 1-based page number.

Returns:

The page number.

getPolygon

public List<PointF> getPolygon()

Gets the polygon coordinates as four points defining a quadrilateral region.

Returns:

An unmodifiable list of four PointF values.

parse

public static List<DocumentSource> parse(String source)

Parses a source string containing one or more document source segments separated by ;.

Parameters:

source - The source string (may contain ; delimiters).

Returns:

An unmodifiable list of DocumentSource instances.

Applies to