Installation Overview

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

跨所有平台安装和配置IronPDF的完整指南。

Nuget IconGet started making PDFs with NuGet now:

  1. Install IronPDF with NuGet Package Manager

    PM > Install-Package IronPdf

  2. Copy and run this code snippet.

    IronPdf.ChromePdfRenderer
           .StaticRenderHtmlAsPdf("<p>Hello World</p>")
           .SaveAs("pixelperfect.pdf");
  3. Deploy to test on your live environment

    Start using IronPDF in your project today with a free trial
    arrow pointer

<hr

1. 平台要求

平台 .NET 版本 硬件 附加要求,兼容性
Logo Table Windows related to 1. 平台要求
Windows
.NET 10, 9, 8, 7, 6, 5, .NET Core, .NET Standard 和 .NET Framework.
  • 最低要求:1核心 & 1.75 GB RAM
  • 推荐:2核心 & 8 GB RAM 或更高
  • Windows 10, 11 和 Windows Server
  • Visual C++ Redistributable (x86 & x64)
Logo Table Linux related to 1. 平台要求
Linux
  • 64位Linux系统:Ubuntu 22, Ubuntu 20, Ubuntu 18, Ubuntu 16, Debian 10-11, CentOS 8, Fedora Linux 33, Amazon, AWS, Linux 2
  • IronCefSubprocess
  • Chrome 依赖项
Logo Table Mac related to 1. 平台要求
macOS
自2020年以来的所有macOS版本

<hr

2. 安装方法

您可以通过两种方式安装IronPDF:本地模式和远程引擎。默认推荐使用本地模式。 对于使用Docker/Kubernetes部署到生产服务器,使用远程引擎模式。

class="col-6">
class="install-mode">
class="install-mode__header"> class="install-mode__title">远程引擎模式 class="install-mode__subtitle">通过gRPC协议进行独立的PDF处理。
class="install-mode__body">
  • 最佳用途:云和容器化部署,支持旧版操作系统。
  • 包:IronPdf.Slim
  • 大小:更轻便,占用几MB的空间。
  • 要求:需要配置到主机的连接。
class="col-6">

<hr

3. 安装选项

安装C# PDF库不超过5分钟。 通过NuGet或直接下载免费获取,立即在Visual Studio中使用。

data-active-tab="1">
class="installation-options__tabs">
data-tab="1"> NuGet 包
data-tab="2"> 手动下载
data-tab="3"> Remote IronPdfEngine
data-tab="1">
data-tab="2">
data-tab="3">
id="nuget-package-start">

转到IronPDF NuGet 库(或在Visual Studio的包管理器控制台中)

  1. 在解决方案资源管理器中,右键单击引用
  2. 选择 '管理 NuGet 包' > '浏览' > 搜索 IronPdf
  3. 选择包并安装。
Install-Package IronPdf

class="related-link">相关: 更多高级 IronPDF Nuget 包

id="nuget-package-end">
id="manual-download-start">
  1. 下载适用于您的平台的 IronPDF DLL 包:Windows、Linux、macOS
  2. 将ZIP文件解压缩到您的解决方案目录内的某个位置。
  3. 在 Visual Studio 解决方案资源管理器中,右键单击 'Dependencies'。
  4. '添加项目引用' > 选择 '浏览' 包含从zip中提取的所有DLL。
id="manual-download-end">
id="remote-ironpdfengine-start">

请注意请注意:每个IronPDF版本需要匹配版本的IronPdfEngine。不支持跨版本。例如,IronPDF 2024.2.2必须使用IronPdfEngine 2024.2.2。

使用NuGet安装IronPdf。

Install-Package IronPdf.Slim
id="remote-ironpdfengine-end">

4. 附加配置

data-active-tab="1">
class="installation-options__tabs">
data-tab="1"> 管理许可
data-tab="2"> 路径&权限
data-tab="3"> 远程引擎
data-tab="1">
data-tab="2">
data-tab="3">
id="manage-license-start">

在购买或注册IronPDF的30天试用版后,请查找发送到您电子邮件的许可密钥。

在应用程序开始时添加您的许可密钥。

IronPdf.License.LicenseKey = "KEY";
IronPdf.License.LicenseKey = "KEY";
IRON VB CONVERTER ERROR developers@ironsoftware.com
$vbLabelText   $csharpLabel

检查许可证状态。

bool valid = IronPdf.License.IsLicensed;
bool valid = IronPdf.License.IsLicensed;
IRON VB CONVERTER ERROR developers@ironsoftware.com
$vbLabelText   $csharpLabel
id="manage-license-end">
id="path-permission-start">

设置IronPdf.Installation对象的TempFolderPath属性。

IronPdf.Installation.TempFolderPath = @"C:\My\Safe\Path";
IronPdf.Installation.TempFolderPath = @"C:\My\Safe\Path";
IronPdf.Installation.TempFolderPath = "C:\My\Safe\Path"
$vbLabelText   $csharpLabel

提示确保在开发和服务器上清除所有临时文件和缓存文件夹,并在更新路径后重新部署干净版本的应用程序。

在应用程序范围内设置临时文件夹环境变量。

using IronPdf;

// Adjusts System.IO.Path.GetTempFileName and System.IO.Path.GetTempPath behavior for the application
var MyTempPath = @"C:\Safe\Path\";
Environment.SetEnvironmentVariable("TEMP", MyTempPath, EnvironmentVariableTarget.Process);
Environment.SetEnvironmentVariable("TMP", MyTempPath, EnvironmentVariableTarget.Process);

// Set IronPDF Temp Path
IronPdf.Installation.TempFolderPath = System.IO.Path.Combine(MyTempPath, "IronPdf");

// Your PDF Generation and editing code
var Renderer = new IronPdf.ChromePdfRenderer();
using var Doc = Renderer.RenderHtmlAsPdf("<h1>Html with CSS and Images</h1>");
Doc.SaveAs("example.pdf");
using IronPdf;

// Adjusts System.IO.Path.GetTempFileName and System.IO.Path.GetTempPath behavior for the application
var MyTempPath = @"C:\Safe\Path\";
Environment.SetEnvironmentVariable("TEMP", MyTempPath, EnvironmentVariableTarget.Process);
Environment.SetEnvironmentVariable("TMP", MyTempPath, EnvironmentVariableTarget.Process);

// Set IronPDF Temp Path
IronPdf.Installation.TempFolderPath = System.IO.Path.Combine(MyTempPath, "IronPdf");

// Your PDF Generation and editing code
var Renderer = new IronPdf.ChromePdfRenderer();
using var Doc = Renderer.RenderHtmlAsPdf("<h1>Html with CSS and Images</h1>");
Doc.SaveAs("example.pdf");
IRON VB CONVERTER ERROR developers@ironsoftware.com
$vbLabelText   $csharpLabel

[{t:(在被锁定的服务器上,给IIS用户(IUSER)读取和写入您安装路径文件夹的权限,以及您Windows和临时文件夹的权限。)}]

id="path-permission-end">
id="remote-engine-start">

[Remote IronPdfEngine] 安装IronPdf.Slim包后,连接到引擎容器并在应用启动时或调用任何IronPDF方法之前配置连接。

假设IronPdfEngine在远程运行,地址为123.456.7.8:33350:

Installation.ConnectToIronPdfHost(
    IronPdf.GrpcLayer.IronPdfConnectionConfiguration.RemoteServer("123.456.7.8:33350")
);
Installation.ConnectToIronPdfHost(
    IronPdf.GrpcLayer.IronPdfConnectionConfiguration.RemoteServer("123.456.7.8:33350")
);
IRON VB CONVERTER ERROR developers@ironsoftware.com
$vbLabelText   $csharpLabel

class="related-link">相关: IronPdfEngine 限制

[Linux] 启用IronPDF自动安装所有必需的Linux依赖项。 第一次HTML到PDF操作可能比平时更长。

Installation.LinuxAndDockerDependenciesAutoConfig = true;
Installation.LinuxAndDockerDependenciesAutoConfig = true;
IRON VB CONVERTER ERROR developers@ironsoftware.com
$vbLabelText   $csharpLabel

[Docker] 预先初始化Chrome引擎以预加载先决条件并加快在Docker中的首次使用。

IronPdf.Installation.Initialize();
IronPdf.Installation.Initialize();
IronPdf.Installation.Initialize()
$vbLabelText   $csharpLabel

class="related-link">相关: IronPDF Linux Docker 兼容性和设置

id="remote-engine-end">

<hr

5. 部署场景

class="col-6">
class="deployment-card">
class="deployment-card__icon"> Logo Azure related to 5. 部署场景
class="deployment-card__info">

class="deployment-card__title">在上运行和部署IronPDF .NET

Azure 功能
class="col-6">
class="deployment-card">
class="deployment-card__icon"> Logo Aws related to 5. 部署场景
class="deployment-card__info">

class="deployment-card__title">在上运行和部署IronPDF .NET

AWS Lambda
class="col-6">
class="deployment-card">
class="deployment-card__icon"> Logo Linux related to 5. 部署场景
class="deployment-card__info">

class="deployment-card__title">在中运行IronPDF

Linux Docker 容器
class="col-6">
class="deployment-card">
class="deployment-card__icon"> Logo Remote related to 5. 部署场景
class="deployment-card__info">

class="deployment-card__title">作为一个运行IronPDF

远程容器

<hr

下一步

<hr

常见问题解答

我如何设置IronPdfEngine进行远程PDF生成?

要设置IronPdfEngine进行远程PDF生成,请从NuGet安装IronPdf.Slim包,并使用IronPdfConnectionConfiguration类配置连接设置。此设置允许您将应用程序远程连接到IronPdfEngine实例。

使用IronPdfEngine与我的应用程序的主要好处是什么?

在应用程序中使用IronPdfEngine可以远程执行PDF任务,帮助避免平台特定的兼容性问题,特别是在旧系统和移动平台上。此外,它在执行期间不需要.NET运行时。

为什么我可能选择使用IronPdfEngine而不是本地PDF库?

您可能选择使用IronPdfEngine来远程运行性能密集型的PDF功能,减少与不同操作系统的兼容性问题,并通过利用与Chrome相同的渲染器提高HTML到PDF转换的性能。

IronPdfEngine支持水平扩展吗?

不,IronPdfEngine目前不支持水平扩展,这意味着由于服务器内存中PDF文件二进制文件的处理方式,它无法负载均衡到多个实例。

IronPdfEngine可以在不同操作系统上运行吗?

IronPdfEngine设计用于使用Docker容器在Linux系统上运行。然而,二进制文件是平台特定的,因此您需要确保使用适合您操作系统的版本。

如果使用IronPdfEngine时我的PDF输出不同,我该怎么办?

由于不同操作系统的行为,PDF输出可能会略有不同。为了减少差异,请确保您使用正确的Docker镜像,并检查可能影响渲染的任何操作系统特定设置。

我如何确保我的应用程序使用正确版本的IronPdfEngine?

为了确保兼容性,每个版本的IronPDF都需要匹配版本的IronPdfEngine。请确保同时更新两个组件,以避免跨版本问题。

在Windows上使用IronPdfEngine有哪些限制?

在Windows上使用IronPdfEngine时,您需要Linux Containers for Docker,并必须确保服务器端口可访问。二进制文件是平台特定的,需要切换到Linux Containers。

如何配置IronPDF以连接到远程IronPdfEngine服务器?

要为远程服务器配置IronPDF,请使用Installation.ConnectToIronPdfHost方法中的IronPdf.GrpcLayer.IronPdfConnectionConfiguration.RemoteServer,指定服务器的IP和端口详细信息。

使用IronPdfEngine时应该使用哪个包以最小化应用程序大小?

您应使用NuGet中的IronPdf.Slim包,因为它仅包含运行IronPDF与IronPdfEngine所需的组件,从而减少应用程序大小。

Curtis Chau
技术作家

Curtis Chau 拥有卡尔顿大学的计算机科学学士学位,专注于前端开发,精通 Node.js、TypeScript、JavaScript 和 React。他热衷于打造直观且美观的用户界面,喜欢使用现代框架并创建结构良好、视觉吸引力强的手册。

除了开发之外,Curtis 对物联网 (IoT) 有浓厚的兴趣,探索将硬件和软件集成的新方法。在空闲时间,他喜欢玩游戏和构建 Discord 机器人,将他对技术的热爱与创造力相结合。

准备开始了吗?
Nuget 下载 16,133,208 | 版本: 2025.11 刚刚发布