PDFium Delphi Component Docs

ObjectType プロパティ

コンポーネント: TPdf  ·  ユニット: PDFium
指定した index にある page object の category を返します。text、path、image、shading、form XObject のいずれかです。分類は object を生成した PDF content-stream operator と一致し、呼び出し側は 1 つの switch dispatch で page-object array を反復できます

Syntax

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

Index0 基準の page-object インデックス。範囲は 0 から ObjectCount - 1

Description

ObjectType は、Index の page object の種類を表す TObjectType 列挙値を返します:

分類は安定していて安価です。ObjectCount を密なループで回すのは、より高コストなアクセサー(ObjectBitmap、ObjectBounds、文字プロパティ)をどれで呼ぶか決める前の、ページコンテンツのトリアージの定石です

このプロパティは form XObject を再帰的に展開しません。タイプは otForm を報告するだけなので、リーフレベルのコンテンツが必要なら、呼び出し側で form 自身のオブジェクトリストへ降りてください

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