修復 IronPDF 中的渲染超時問題

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

IronPDF 的預設渲染逾時時間為60 秒。 如果渲染過程在此時間內未完成,則會拋出逾時運行時異常。

對於包含大量影像資源或需要額外時間渲染的輸入,建議調整 RenderDelay 持續時間。 這樣一來,在產生 PDF 之前,素材就可以在虛擬環境中完全渲染出來。 否則可能會導致 PDF 文件中缺少資源,甚至產生空白 PDF 文件。

若要覆蓋預設設置,請在ChromePdfRenderOptions類別中調整 Timeout 持續時間,並透過WaitFor包裝物件在RenderDelay方法中指定延遲持續時間。

例子

// Create a new instance of ChromePdfRenderOptions
ChromePdfRenderOptions renderOptions = new ChromePdfRenderOptions();

// Increase the timeout for the rendering process to 120 seconds
renderOptions.Timeout = 120; // seconds

// Increase the delay before rendering to ensure all assets are fully loaded
renderOptions.WaitFor.RenderDelay(3000); // milliseconds (3 seconds)
// Create a new instance of ChromePdfRenderOptions
ChromePdfRenderOptions renderOptions = new ChromePdfRenderOptions();

// Increase the timeout for the rendering process to 120 seconds
renderOptions.Timeout = 120; // seconds

// Increase the delay before rendering to ensure all assets are fully loaded
renderOptions.WaitFor.RenderDelay(3000); // milliseconds (3 seconds)
' Create a new instance of ChromePdfRenderOptions
Dim renderOptions As New ChromePdfRenderOptions()

' Increase the timeout for the rendering process to 120 seconds
renderOptions.Timeout = 120 ' seconds

' Increase the delay before rendering to ensure all assets are fully loaded
renderOptions.WaitFor.RenderDelay(3000) ' milliseconds (3 seconds)
$vbLabelText   $csharpLabel

請查看以下文章,以了解有關超時和渲染延遲的更多資訊。

Timeout PDF渲染超時

渲染延遲 -如何使用 JavaScript 將 HTML 轉換為 PDF 如何在Chrome瀏覽器中調試HTML程式碼以建立像素級完美的PDF文件

若要向我們的工程師提出服務請求,請參閱:工程請求 IronPDF

從 2021.12.4995 版本開始,IronPDF 的預設渲染逾時時間為 60 秒。

Curtis Chau
技術作家

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

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

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