在 IronPDF 中排查 Chrome 依賴項問題

This article was translated from English: Does it need improvement?
Translated
View the article in English

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 手動將其新增至專案。 可以新增多個相依性:

請注意在 IronPDF 的更高版本中,如果專案資料夾中缺少所需的二進位文件,則會根據執行時間使用的作業系統從 NuGet 來源自動下載這些二進位檔案。 只要專案已連接到互聯網,並且對專案資料夾擁有讀取、寫入和執行權限,此操作即可成功。

在 Windows 系統上,最好確保目標作業系統已安裝Visual C++ 執行階段環境。 許多現代應用程式如果沒有這個重要的作業系統元件就無法運作。

我們還有LinuxDocker的兼容性指南。

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.All
$vbLabelText   $csharpLabel

IronPDF 產生的日誌檔案位於專案 /bin 目錄中,也就是 DLL 檔案部署所在的目錄:

  • default.log(部署流程)
  • cef.log(渲染)
  • IronSoftwareCefSubprocess.log(渲染和線程)
  • IronSoftwareEngine.log (用於偵錯以"從...產生 PDF 時出錯"開頭的異常)

雲端伺服器通常會為日誌檔案指定特定的存放位置。 我們有關於在AzureAWS中產生日誌檔案的指南。

Curtis Chau
技術作家

Curtis Chau 擁有卡爾頓大學計算機科學學士學位,專注於前端開發,擅長於 Node.js、TypeScript、JavaScript 和 React。Curtis 熱衷於創建直觀且美觀的用戶界面,喜歡使用現代框架並打造結構良好、視覺吸引人的手冊。

除了開發之外,Curtis 對物聯網 (IoT) 有著濃厚的興趣,探索將硬體和軟體結合的創新方式。在閒暇時間,他喜愛遊戲並構建 Discord 機器人,結合科技與創意的樂趣。

準備好開始了嗎?
Nuget 下載 16,685,821 | 版本: 2025.12 剛發表