PDFium Component Docs

ObjectCount 속성

이 API 항목은 식별자, 시그니처, 코드 블록, PDF 용어를 원래 형태로 유지합니다.
컴포넌트: TPdf  ·  유닛: PDFium
현재 page의 page object 수를 읽기 전용으로 반환합니다 (text, path, image, shading, form)

구문

property ObjectCount: Integer; // read only

설명

열린 PDF document에 연결된 page object 수를 반환합니다 (text, path, image, shading, form). Page가 다른 page index로 바뀌면 count도 바뀌므로, 모든 ObjectHandle[Index]를 순회하는 for loop의 상한으로 사용할 수 있습니다

값은 underlying PDFium engine에서 직접 읽습니다. ActiveTrue이고 현재 page가 로드되어 있어야 합니다. 문서가 닫혔거나, 질의한 scope에 page object가 없거나, 현재 PDF에 이 property가 적용되지 않으면 결과는 0입니다

이 counter는 PDFium이 첫 접근 시 지연 계산하므로, 첫 호출에서 관련 object stream을 parse할 수 있습니다(예: page의 /Annots array 또는 document의 /Names tree) 이후 호출은 O(1)입니다

비고

예제

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;

참고 항목

ObjectHandle, ObjectBounds, ObjectTransparent