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 使创建和使用临时文件变得轻而易举。