PDFium Delphi Component Docs

PdfLibraryConfigurationSupportError function

Unit: PDFium
Reports why a library configuration cannot be applied to a given PDFium build, and returns an empty string when it can

Syntax

function PdfLibraryConfigurationSupportError(const Configuration: TPdfLibraryConfiguration; SkiaBuild, FontationsBuild: Boolean): string;

Parameters

ConfigurationTPdfLibraryConfiguration. The settings to check
SkiaBuildBoolean. True when the PDFium build has Skia support and exports FPDF_RenderPageSkia
FontationsBuildBoolean. True when the PDFium build carries the Fontations font backend

Return Value

string: empty when the configuration is supported, otherwise a description of whichever setting is unsupported

Description

PDFium's native initialisation halts the whole process when it is handed a renderer or font backend the build does not contain; it does not return an error

LoadLibrary therefore runs this check after binding the exports and before native initialisation: prpSkia requires a Skia build and pfbpFontations requires a Fontations build. Should the check fail, LoadLibrary unloads the library, leaves the configuration unsealed and raises EPdfError, so the application can call ConfigurePdfLibrary with other settings and try again

Skia support is detected from the FPDF_RenderPageSkia export. PDFium exports nothing for Fontations, so LoadLibrary looks for the Rust font crates this backend links into the library file; a library file that cannot be read is treated as not supporting it

The bundled pdfium.dll and pdfium.v8.dll are Skia builds without Fontations

Remarks

Example

Config := GetPdfLibraryConfiguration;
Config.Renderer := prpSkia;
ConfigurePdfLibrary(Config);
try
  LoadLibrary;
except
  on E: EPdfError do
  begin
    Config.Renderer := prpDefault;
    ConfigurePdfLibrary(Config);
    LoadLibrary;
  end;
end;

See Also

ConfigurePdfLibrary, PdfNativeRendererType, PdfLibraryConfigurationSealed