修復 IronPDF 中的渲染超時問題
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)請查看以下文章,以了解有關超時和渲染延遲的更多資訊。
Timeout PDF渲染超時
渲染延遲 -如何使用 JavaScript 將 HTML 轉換為 PDF 如何在Chrome瀏覽器中調試HTML程式碼以建立像素級完美的PDF文件
若要向我們的工程師提出服務請求,請參閱:工程請求 IronPDF 。
從 2021.12.4995 版本開始,IronPDF 的預設渲染逾時時間為 60 秒。






