PDFiumVCL Docs

FontHandle property

이 API 항목은 식별자, 시그니처, 코드 블록, PDF 용어를 원래 형태로 유지합니다.
Component: TPdf  ·  Unit: PDFium
Returns the native FPDF_FONT handle of the font used by a page object. The handle gives advanced callers direct access to PDFium font APIs not wrapped by the component.

Syntax

property FontHandle[Index: Integer]: FPDF_FONT; // read only

Description

FontHandle returns the raw PDFium font pointer (FPDF_FONT) associated with the text page object at the supplied index. Internally the value is what PDFium returns from FPDFTextObj_GetFont; most of the other Font* properties on TPdfFontAscent, FontDescent, FontFamilyName, FontBaseName, FontIsEmbedded, FontItalicAngle, FontWeight, FontData — are convenience wrappers built on top of it.

The index is a 0-based page-object index in the range 0..ObjectCount - 1. Only objects of type text carry a font; for image, path, or shading objects the call returns nil. A page must be active before reading the property.

The returned handle is owned by PDFium and remains valid only while the current page is loaded. Do not free it, do not store it across page changes, and do not call destructive PDFium APIs against it — treat it as an opaque, read-only token.

Parameters

Index0-based page-object index. Use ObjectType first to confirm the object is text; non-text objects return nil.

Remarks

Example

var
  I: Integer;
  H: FPDF_FONT;
begin
  Pdf1.PageNumber := 1;
  for I := 0 to Pdf1.ObjectCount - 1 do
  begin
    H := Pdf1.FontHandle[I];
    if H <> nil then
      Memo1.Lines.Add(Format('Object %d uses font %s',
        [I, Pdf1.FontFamilyName[I]]));
  end;
end;

See Also

FontFamilyName, FontBaseName, FontIsEmbedded, FontData, ObjectCount, ObjectType