PDFium Delphi Component Docs

BindPdfDocumentCoreRuntime function

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

Syntax

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

Description

Builds the runtime by putting each of the 25 required PDFium exports to Resolver, running from FPDF_LoadMemDocument64, FPDF_GetPageCount and FPDFText_GetText through to FPDF_RenderPageBitmap, FPDF_SaveAsCopy and FPDFPage_SetRotation; the first export that cannot be found raises EPdfDocumentCore naming the unresolved symbol

Lifetime is an arbitrary interface reference the runtime hangs on to: an application that loads its own engine library passes the library owner so the library stays loaded whilst core documents exist. Every TPdfDocumentCore created from the runtime keeps its own reference to the runtime, so the lifetime owner is only let go once the last core document has been freed

TPdf.CreateCoreSnapshot calls this routine 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