property ObjectType[Index: Integer]: TObjectType; // read only
| Index | Zero-based page-object index, in the range 0 to ObjectCount - 1. |
ObjectType returns a TObjectType enumeration value describing
the kind of page object at Index:
otText — text-showing operator (Tj, TJ, ', ") — a run of glyphs sharing a font and text matrix.otPath — vector path: lines, curves, rectangles, and fills. Use ObjectBounds to get the on-page rectangle.otImage — raster image. Pair with ObjectBitmap to retrieve pixels.otShading — gradient or function-based shading pattern (PDF axial/radial/coon shading).otForm — form XObject: a reusable sub-stream that may itself contain text, paths, and images.The classification is stable and inexpensive; calling it in a tight loop over
ObjectCount is the standard way to triage page
content before deciding which more expensive accessor (ObjectBitmap,
ObjectBounds, character properties) to call.
Form XObjects are not recursively expanded by this property — the type
reports otForm and callers must descend into the form's own object list
if they need the leaf-level content.
otText for indices that fall outside the valid range; always guard with ObjectCount.FPDF_PAGEOBJ_* constants from the underlying native API.
// Histogram of object types on the current page
var
I: Integer;
Counts: array[TObjectType] of Integer;
T: TObjectType;
begin
FillChar(Counts, SizeOf(Counts), 0);
for I := 0 to Pdf.ObjectCount - 1 do
Inc(Counts[Pdf.ObjectType[I]]);
for T := Low(TObjectType) to High(TObjectType) do
Memo1.Lines.Add(Format('%s: %d', [GetEnumName(TypeInfo(TObjectType), Ord(T)), Counts[T]]));
end;