PDFium Delphi Component Docs

ObjectCount プロパティ

コンポーネント: TPdf  ·  ユニット: PDFium
現在ページにある page object (text、path、image、shading、form) の読み取り専用件数です

Syntax

property ObjectCount: Integer; // read only

Description

開いている PDF ドキュメントに関連付けられた page object(text、path、image、shading、form)の数を返します。カウントは Page を別のページインデックスへ割り当てると変わるため、すべての ObjectHandle[Index] を歩く for ループの上限として使えます

値は基底の PDFium エンジンから直接読まれます(Active が True で現在ページがロードされている必要があります)。ドキュメントが閉じている、問い合わせたスコープに page object(text、path、image、shading、form)がない、現在の PDF にこのプロパティが適用されない、のいずれかでは結果は 0 です

このカウンタは PDFium が最初のアクセス時に遅延計算するため、最初の呼び出しで関連するオブジェクト stream(ページの /Annots 配列やドキュメントの /Names ツリーなど)の解析が走ることがあります。2 回目以降の呼び出しは O(1) です

Remarks

Example

var

  I: Integer;

begin

  if not Pdf1.Active then Exit;

  Memo1.Lines.Add(Format('%d page objects (text, path, image, shading, form)', [Pdf1.ObjectCount]));

  for I := 0 to Pdf1.ObjectCount - 1 do

  begin

    // inspect each item

    Memo1.Lines.Add(Format(' [%d]', [I]));

  end;

end;

See Also

ObjectHandle, ObjectBounds, ObjectTransparent