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./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 建立的日誌檔案位於您的專案中部署 DLL 的 /bin 目錄下:

  • default.log (部署流程)
  • cef.log (渲染)
  • IronSoftwareCefSubprocess.log (渲染與執行緒)
  • IronSoftwareEngine.log(用於除錯以"Error generating PDF from..."開頭的例外狀況)

雲端伺服器通常會為日誌檔案指定特定儲存位置。 我們提供在 AzureAWS 中建立日誌檔案的指南。

Curtis Chau
技術撰稿人

Curtis Chau 擁有卡爾頓大學(Carleton University)的電腦科學學士學位,專精於前端開發,並精通 Node.js、TypeScript、JavaScript 及 React。他熱衷於打造直觀且美觀的用戶介面,喜歡運用現代框架,並創建結構完善、視覺上吸引人的手冊。

除了開發工作之外,Curtis 對物聯網(IoT)抱有濃厚興趣,致力於探索整合硬體與軟體的創新方法。閒暇時,他喜歡玩遊戲和開發 Discord 機器人,將對科技的熱愛與創意相結合。

準備開始了嗎?
Nuget 下載 19,014,616 | 版本: 2026.5 just released
Still Scrolling Icon

還在往下捲動嗎?

想要快速確認成果嗎? PM > Install-Package IronPdf
執行範例 觀看您的 HTML 轉為 PDF。