PDFium Delphi Component Docs

ConfigurePdfLibrary 过程

单元: PDFium
设置下一次 LoadLibrary 调用所使用的进程级原生初始化设置

语法

procedure ConfigurePdfLibrary(const Configuration: TPdfLibraryConfiguration);

参数

ConfigurationTPdfLibraryConfiguration

说明

ConfigurePdfLibrary 保存原生初始化设置,LoadLibrary 在首次加载 PDFium 模块时会将其传递给 FPDF_InitLibraryWithConfig

该记录涵盖 UserFontPaths、V8Isolate、V8EmbedderSlot、V8Platform、Renderer(prpAgg 或 prpSkia)、FontBackend(pfbpFreeType 或 pfbpFontations)、BrotliEnabled、IsolatePerDocument 和 AllowMachineTime

IsolatePerDocument 对应 FPDF_LIBRARY_CONFIG 版本 7 的 m_IsolatePerDocument 标志:启用 V8 的 pdfium.dll 会为每个文档创建专属的 v8::Isolate,而不是整个进程共享一个 isolate。该选项只在 V8 构建下生效,且必须与 nil 的 V8Isolate 搭配使用

配置会被深拷贝,包括 UserFontPaths 数组,因此之后对调用方记录的修改不会产生任何影响

AllowMachineTime 控制在原生初始化完成后立即应用的 FPDF_SetSandBoxPolicy 机器时间策略,TPdfLibraryConfiguration.Hardened 是禁用该策略的快捷方式

备注

示例

Config := TPdfLibraryConfiguration.Hardened;
Config.Renderer := prpSkia;
ConfigurePdfLibrary(Config);

参见

GetPdfLibraryConfiguration, PdfLibraryConfigurationSealed, PdfNativeRendererType, PdfLibraryConfigurationSupportError, TPdf.LoadLibrary, ConfigureSystemFontProvider