PDFium Delphi Component Docs

BindPdfDocumentCoreRuntime function

Unit: FPdfDocumentCore
Resolves the required native exports into an IPdfDocumentCoreRuntime that pins a caller-owned lifetime reference

Syntax

function BindPdfDocumentCoreRuntime(Resolver: TPdfCoreSymbolResolver;
  const Lifetime: IInterface): IPdfDocumentCoreRuntime;

Description

Creates the runtime by asking Resolver for each of the 25 required PDFium exports, from FPDF_LoadMemDocument64, FPDF_GetPageCount and FPDFText_GetText through FPDF_RenderPageBitmap, FPDF_SaveAsCopy and FPDFPage_SetRotation; the first missing export raises EPdfDocumentCore with the unresolved symbol name

Lifetime is an arbitrary interface reference the runtime retains: an application that loads its own engine library passes the library owner so the library stays loaded while core documents exist. Every TPdfDocumentCore created from the runtime holds the runtime, so the lifetime owner is released only after the last core document is freed

TPdf.CreateCoreSnapshot calls this function internally with a resolver over the loaded pdfium.dll and a library lease taken under the PDFium load lock

Remarks

Example

Runtime := BindPdfDocumentCoreRuntime(ResolveExport, LibraryOwner);
Core := TPdfDocumentCore.Create(Runtime, TPdfDocumentCoreOptions.Default);
Core.LoadBytes(Bytes);

See Also

FPdfDocumentCore, TPdf.CreateCoreSnapshot