PDFium Delphi Component Docs

PageObjectInfo method

Component: TPdf  ·  Unit: PDFium
Read every editable attribute of one page object on the current page in a single call

Syntax

function PageObjectInfo(Index: Integer): TPdfPageObjectInfo;

IndexInteger. Zero-based index of the page object, in content-stream order. Valid values run from 0 to ObjectCount - 1
ResultTPdfPageObjectInfo. A snapshot record holding the object handle, type, bounds, transform matrix, fill and stroke colours, stroke width, line join and cap, and dash pattern

Description

Collects in one record what would otherwise take a dozen separate PDFium calls: the object type, its axis-aligned Bounds, its rotated bounds when the object carries a rotation, the transform Matrix, the fill and stroke colours with their alpha values, the stroke width, the line join and cap styles, and the dash array with its phase

Attributes that a given object type does not carry are reported as absent rather than as zero: each optional group has a Has... flag (HasMatrix, HasFillColor, HasStrokeWidth, and so on). A text object has no stroke width, so HasStrokeWidth is False and StrokeWidth is meaningless - checking the flag is the only way to tell "no stroke" from "a stroke of width 0"

The record is a snapshot, not a live view. Editing its fields changes nothing in the document; pass the modified record back through UpdatePageObject together with the set of fields that should be written

Example

var Info: TPdfPageObjectInfo;
Info := Pdf.PageObjectInfo(0);
if Info.HasFillColor then
  ShowMessage(ColorToString(Info.FillColor));

See Also

UpdatePageObject, ObjectType, ObjectBounds, ObjectCount, PathInfo