在 IronPDF 中排查 Chrome 依賴項問題
Google Chromium HTML 渲染器是 IronPDF 的"Html 轉 PDF"渲染過程中的重要組成部分。 該渲染器的基本二進位檔案應該很容易在 IronPDF NuGet 套件中找到。 專案資料夾中缺少此二進位檔案將引發以下錯誤:
Unhandled exception. IronSoftware.Exceptions.IronSoftwareDeploymentException: Error while deploying IronPdf Chrome renderer: 'Unable to locate 'IronInterop'.如果 IronPDF 無法自動部署 Chrome 依賴項,則可能需要透過 NuGet 手動將其新增至專案。 可以新增多個相依性:
在 Windows 系統上,最好確保目標作業系統已安裝Visual C++ 執行階段環境。 許多現代應用程式如果沒有這個重要的作業系統元件就無法運作。
Linux
- 確保使用正確的 Docker 檔案。
- 使用 IronPdf.Linux NuGet 套件代替 IronPdf。
將 Chrome 渲染的 GPU 模式設定為停用:
IronPdf.Installation.ChromeGpuMode = IronPdf.Engines.Chrome.ChromeGpuModes.Disabled;IronPdf.Installation.ChromeGpuMode = IronPdf.Engines.Chrome.ChromeGpuModes.Disabled;IronPdf.Installation.ChromeGpuMode = IronPdf.Engines.Chrome.ChromeGpuModes.Disabled$vbLabelText $csharpLabel停用 Linux 和 Docker 依賴項的自動配置:
csharp Installation.LinuxAndDockerDependenciesAutoConfig = false;csharp Installation.LinuxAndDockerDependenciesAutoConfig = false;csharp Installation.LinuxAndDockerDependenciesAutoConfig = False$vbLabelText $csharpLabel
macOS
- 檢查 .NET 執行時期是否設定為正確的架構 - x64 或 arm64。
如果那樣還不能解決問題怎麼辦?
如果以上方法未能解決問題,我們將竭誠為您提供協助。相容性是我們工程團隊的首要任務。 請發送電子郵件至[電子郵件地址]提交錯誤報告。support@ironsoftware.com 。 所有相容性問題都將由高級工程師認真審查。
請務必告知我們部署到的作業系統/平台,特別是如果是 AWS 或 Azure 等雲端平台。
如何在 IronPDF 中啟用原生日誌記錄
將日誌檔案附加到錯誤報告中,可以使我們快速定位問題並解決問題的機率增加一倍以上。
請將此程式碼新增至程式碼頂部,並在執行任何 IronPDF 方法之前執行(2021.3.1 之後的所有版本):
// Set the log file path, this can be a directory or a full file path
IronPdf.Logging.Logger.LogFilePath = "Default.log";
// Enable all logging modes for detailed logging information
IronPdf.Logging.Logger.LoggingMode = IronPdf.Logging.Logger.LoggingModes.All;// Set the log file path, this can be a directory or a full file path
IronPdf.Logging.Logger.LogFilePath = "Default.log";
// Enable all logging modes for detailed logging information
IronPdf.Logging.Logger.LoggingMode = IronPdf.Logging.Logger.LoggingModes.All;' Set the log file path, this can be a directory or a full file path
IronPdf.Logging.Logger.LogFilePath = "Default.log"
' Enable all logging modes for detailed logging information
IronPdf.Logging.Logger.LoggingMode = IronPdf.Logging.Logger.LoggingModes.AllIronPDF 產生的日誌檔案位於專案 /bin 目錄中,也就是 DLL 檔案部署所在的目錄:
- default.log(部署流程)
- cef.log(渲染)
- IronSoftwareCefSubprocess.log(渲染和線程)
- IronSoftwareEngine.log (用於偵錯以"從...產生 PDF 時出錯"開頭的異常)






