using IronPdf;
using System;
using System.IO;
// Set Application scope Temp Path (On Linux /tmp is a good choice)
var MyTempPath = @"C:\Safe\Location\";
Environment.SetEnvironmentVariable("TEMP", MyTempPath);
Environment.SetEnvironmentVariable("TMP", MyTempPath);
// Set IronPDF Temp Path
Installation.TempFolderPath = Path.Combine(MyTempPath, "IronPdfTemp");
// Your PDF Generation and editing code here
var renderer = new ChromePdfRenderer();
var doc = renderer.RenderHtmlAsPdf("<h1>Html with CSS and Images</h1>");
doc.SaveAs("example.pdf");
Imports IronPdf
Imports System
Imports System.IO
' Set Application scope Temp Path (On Linux /tmp is a good choice)
Private MyTempPath = "C:\Safe\Location\"
Environment.SetEnvironmentVariable("TEMP", MyTempPath)
Environment.SetEnvironmentVariable("TMP", MyTempPath)
' Set IronPDF Temp Path
Installation.TempFolderPath = Path.Combine(MyTempPath, "IronPdfTemp")
' Your PDF Generation and editing code here
Dim renderer = New ChromePdfRenderer()
Dim doc = renderer.RenderHtmlAsPdf("<h1>Html with CSS and Images</h1>")
doc.SaveAs("example.pdf")
Install-Package IronPdf
設定臨時PDF文件路徑
IronPDF,和許多其他軟體一樣,會在您創建、編輯和渲染 PDF 項目時偶爾生成臨時文件。這通常是不可避免且必要的,因為它們通常用於暫時存儲工作數據。為了更容易處理這些情況,IronPDF 讓您可以控制臨時文件夾的位置以及其他臨時 PDF 文件路徑的設置。IronPDF 使創建和使用臨時文件變得輕而易舉。