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에서 직접 읽습니다. Active가 True이고 현재 page가 로드되어 있어야 합니다. 문서가 닫혔거나, 질의한 scope에 page object가 없거나, 현재 PDF에 이 property가 적용되지 않으면 결과는 0입니다
이 counter는 PDFium이 첫 접근 시 지연 계산하므로, 첫 호출에서 관련 object stream을 parse할 수 있습니다(예: page의 /Annots array 또는 document의 /Names tree) 이후 호출은 O(1)입니다
Active가 False이거나 관련 PDF dictionary entry가 없으면 0을 반환합니다ObjectHandle[Index]를 읽을 때는 0 .. ObjectCount - 1 범위를 유효 범위로 보세요. 범위를 벗어난 index는 EPdfError를 raise합니다
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;