PDFium Delphi Component Docs

Page property

Component: TPdf  ·  Unit: PDFium
Native PDFium page handle for the currently active page

Syntax

property Page: FPDF_PAGE; // read only

Description

Page exposes the raw PDFium FPDF_PAGE handle bound to the currently active page. The handle is allocated when PageNumber is set (or when Active transitions to True) and is kept alive for the lifetime of that page binding. It is the same handle PDFium’s C API expects for every FPDFPage_*, FPDF_RenderPage*, annotation, content stream and form widget call

The handle is valid only whilst Active is True and a valid PageNumber is set. Assigning a new PageNumber, calling ReloadPage, or setting Active back to False destroys the existing handle and, in the first two cases, creates a new one. Do not call FPDF_ClosePage on this handle — the component owns its lifetime and tears it down automatically

Page is an advanced property, useful when calling PDFium APIs that PDFium Delphi Component has not yet wrapped — custom appearance stream regeneration, page-object bookkeeping or low-level text-extraction tweaks, say. Most callers are better served by the high-level properties (PageWidth, PageHeight, RenderPage, Annotation and so on), which already manage the handle for you

Remarks

Example

var P: FPDF_PAGE;
Pdf1.Active := True;
Pdf1.PageNumber := 1;
P := Pdf1.Page;
if Assigned(P) then
  ShowMessage(Format('%.0f x %.0f points',
    [FPDF_GetPageWidth(P), FPDF_GetPageHeight(P)]));

See Also

Document, PageNumber, TextPage, FormHandle