PDFium Component Docs

AnnotationCount 속성

이 API 항목은 식별자, 시그니처, 코드 블록, PDF 용어를 원래 형태로 유지합니다.
컴포넌트: TPdf  ·  유닛: PDFium
현재 활성 page에 붙어 있는 annotation object 수입니다

구문

property AnnotationCount: Integer; // read only

설명

AnnotationCount는 현재 page의 /Annots array 길이를 반환합니다(PDF 1.7 spec 12.5절). text note, highlight, underline, free-text, ink, stamp, polygon, polyline shape, link annotation, popup dialog, form widget annotation 등 모든 annotation subtype이 카운트됩니다. 모든 page의 값을 합치면 문서 전체 annotation 총계를 얻을 수 있습니다

이 속성은 ActiveTrue여야 하며 PageNumber가 가리키는 page에서 읽습니다. page에 annotation이 없거나 문서가 로드되지 않았으면 값은 0입니다. 각 entry의 subtype, bounding rectangle, colour, flag bitmask, contents text를 담은 TPdfAnnotation record를 얻으려면 0부터 AnnotationCount - 1까지의 인덱스로 Annotation[Index]를 사용하세요

annotation을 순회하는 비용은 O(n)이지만 각 Annotation[Index] 호출은 새 PDFium handle을 열고 필요할 때 Unicode contents를 디코딩합니다. 여러 번 쓸 값이면 결과를 캐시하세요. page annotation을 편집(insert, delete)하면 인덱스가 무효화되므로, 편집 후에는 루프를 다시 시작하거나 AnnotationCount를 다시 읽으세요

비고

예제

var I: Integer;
var A: TPdfAnnotation;
for I := 0 to Pdf1.AnnotationCount - 1 do
begin
  A := Pdf1.Annotation[I];
  Memo1.Lines.Add(Format('%d: subtype=%d text=%s',
    [I, Ord(A.Subtype), A.ContentsText]));
end;

참고 항목

Annotation, LinkAnnotationCount, FormFieldCount, PageNumber