PDFium Delphi Component Docs

PdfLibraryConfigurationSupportError function

Unit: PDFium
Reports why a library configuration cannot be applied to a PDFium build, or 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 for a PDFium build with Skia support, which exports FPDF_RenderPageSkia
FontationsBuildBoolean. True for a PDFium build with the Fontations font backend

Return Value

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

Description

PDFium's native initialization stops the whole process when it receives a renderer or font backend that the build does not contain; it does not return an error

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

Skia support is detected from the FPDF_RenderPageSkia export. PDFium exports nothing for Fontations, so LoadLibrary looks for the Rust font crates that 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