PDFium Component Docs

ObjectType-egenskap

Component: TPdf  ·  Unit: PDFium
Returnerer kategorien til sideobjektet ved den angitte indeksen — tekst, bane, bilde, skyggelegging eller form XObject. Klassifiseringen samsvarer med PDF-innholdsstrømsoperatøren som produserte objektet og lar kallere iterere sideobjektarrayen med én enkelt switch-dispatch

Syntax

property ObjectType[Index: Integer]: TObjectType; // read only

IndexZero-based page-object index, in the range 0 to ObjectCount - 1.

Description

ObjectType returns a TObjectType enumeration value describing the kind of page object at Index:

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.

Remarks

Example

// 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;

See Also

ObjectCount, ObjectBounds, ObjectBitmap, RemoveObject