PDFium Component Docs

CharacterGenerated 속성

이 API 항목은 식별자, 시그니처, 코드 블록, PDF 용어를 원래 형태로 유지합니다.
컴포넌트: TPdf  ·  유닛: PDFium
지정한 인덱스의 character가 page content stream에 직접 그려진 것이 아니라 PDFium이 text extraction 중 합성한 것일 때 True를 반환합니다. 합성 character는 ligature 확장, soft hyphenation, 단어/줄 경계 휴리스틱에 대해 생성되며, search와 select-all 결과가 자연스럽게 읽히도록 해줍니다

구문

property CharacterGenerated[Index: Integer]: Boolean; // read only

Index현재 page의 0 기반 character index입니다. 범위는 0 .. CharacterCount - 1입니다

설명

CharacterGenerated는 지정한 인덱스의 character가 원본 content stream에 있던 것이 아니라 PDFium 내부에서 생성된 것일 때 True를 반환합니다. 대표적인 예는 ligature 분해(fi ligature glyph를 f + i로 나눔), 시각적으로 분리된 인접 text run 사이에 PDFium이 넣는 trailing space, 각 시각적 line 끝에 삽입되는 line-break character입니다

생성된 character는 page content stream에 별도 그리기가 없으므로 bounding box를 이웃 glyph에서 유도합니다. pixel-accurate hit-testing이 필요하면 주의해서 다루세요; 해당 CharacterRectangle은 너비나 높이가 0인 영역으로 접힐 수 있습니다

정확한 verbatim extraction(디지털 서명, text의 hash, page content stream과의 ASCII 일치 비교) 같은 작업에서는 먼저 생성된 character를 걸러내세요. 일반적인 text search와 clipboard copy에서는 이 flag가 순전히 정보용입니다. PDFium은 사용자가 기대하는 대로 이미 character를 삽입해 둡니다

비고

예제

// content stream에 있는 character만 포함하는 verbatim string을 만듭니다
var
  I: Integer;
  S: WString;
begin
  S := '';
  for I := 0 to Pdf.CharacterCount - 1 do
    if not Pdf.CharacterGenerated[I] then
      S := S + Pdf.Character[I];
  Memo1.Text := S;
end;

참고 항목

Character, CharacterIsHyphen, CharacterMapError, CharacterRectangle, Text