PDFium Delphi Component Docs

ConfigurePdfLibrary 程序

單元: PDFium
設定下一次 LoadLibrary 呼叫所使用的處理序級原生初始化設定

語法

procedure ConfigurePdfLibrary(const Configuration: TPdfLibraryConfiguration);

參數

ConfigurationTPdfLibraryConfiguration

說明

ConfigurePdfLibrary 會儲存原生初始化設定,當 PDFium 模組首次載入時,LoadLibrary 會將它們傳給 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