procedure ConfigurePdfLibrary(const Configuration: TPdfLibraryConfiguration);
| Configuration | TPdfLibraryConfiguration |
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 則是停用該政策的捷徑
EPdfErrorpfbpDefault 以外的 FontBackend,必須搭配 Renderer prpSkia,否則會引發 EPdfErrorprpDefault 仍保留 DLL 的預設算繪器;見 PdfNativeRendererTypeprpSkia,或在沒有 Fontations 的建置上指定 FontBackend pfbpFontations,會讓下一次 LoadLibrary 引發 EPdfError 且設定保持未封固,而不是讓原生初始化中止處理序;見 PdfLibraryConfigurationSupportErrorEPdfErrorEPdfError,因為原生程式庫在初始化時會拒絕這種組合Config := TPdfLibraryConfiguration.Hardened;
Config.Renderer := prpSkia;
ConfigurePdfLibrary(Config);