比较

Nutrient.io 与 IronPDF:技术比较指南

当 .NET 开发人员需要 PDF 处理功能时,他们经常会遇到 Nutrient.io(以前称为 PSPDFKit)——该平台已从 PDF SDK 转型为完整的文档智能解决方案。 本文将从关键技术方面对 Nutrient.io 和IronPDF进行比较,以帮助开发人员、架构师和技术决策者为其 PDF 生成和处理工作流程选择合适的工具。

什么是 Nutrient.io?

Nutrient.io(前身为 PSPDFKit)已从一个以 PDF 为中心的库转变为一个完整的文档智能平台。 这一变化使其功能不再局限于简单的 PDF 处理,而是扩展到包括 AI 驱动的文档分析和广泛的文档工作流程功能。

该库通过其PdfProcessor.CreateAsync()异步创建。 HTML到PDF转换、文档合并和水印标记等操作都通过AddAnnotationAsync()等方法使用async/await模式。

平台架构将 Nutrient.io 定位为大型组织的企业定价结构。 从 PSPDFKit 到 Nutrient.io 的品牌重塑造成了文档的复杂性,有时软件包名称和参考文献会使用这两个名称。

什么是 IronPDF?

IronPDF 是专为 .NET 环境设计的专用 PDF 库。IronPDF并没有将自己定位为文档智能平台,而是专注于 PDF 操作:生成、操作、合并、水印等。

ChromePdfRenderer 类是生成 PDF 的主要接口,它使用基于 Chromium 的渲染引擎将 HTML、CSS 和 JavaScript 转换为高保真 PDF 文档。 PdfDocument类为现有PDF提供了广泛的操作能力。

IronPDF 的架构强调简单性,同时提供同步和异步方法,以适应不同的应用模式。 配置通过RenderingOptions属性进行,设置可以通过IDE自动完成发现。

架构方法比较

这些库的根本区别在于其范围和复杂性。 Nutrient.io 已经成长为一个平台,而IronPDF仍然是一个专注的库。

方面Nutrient.io (PSPDFKit)IronPDF
范围文档智能平台专用 PDF 库
复杂性高,全平台的一部分适中,侧重于 PDF 任务
定价企业级适用于不同规模的团队
PDF焦点更广泛的文档框架的一部分独有的 PDF 功能
集成由于功能众多,可能较为复杂。简单明了
目标用户需要高级文档技术的大型组织需要可靠 PDF 工具的开发人员
API 风格异步优先、复杂同步与异步选项
学习曲线陡峭(平台)温和(库)

Nutrient.io 的平台方法意味着即使只需要进行基本的 PDF 操作,应用程序也能获得人工智能功能和文档工作流程功能。 这可能会给要求简单的项目带来不必要的复杂性。

HTML 至 PDF 转换

这两个库都支持将 HTML 内容转换为 PDF 文档。 API 模式在复杂性和风格上存在很大差异。

Nutrient.io HTML 转 PDF 方法:

// NuGet: Install-Package PSPDFKit.Dotnet
using PSPDFKit.Pdf;
using System.Threading.Tasks;

class Program
{
    static async Task Main()
    {
        var htmlContent = "<html><body><h1>Hello World</h1></body></html>";

        using var processor = await PdfProcessor.CreateAsync();
        var document = await processor.GeneratePdfFromHtmlStringAsync(htmlContent);
        await document.SaveAsync("output.pdf");
    }
}
// NuGet: Install-Package PSPDFKit.Dotnet
using PSPDFKit.Pdf;
using System.Threading.Tasks;

class Program
{
    static async Task Main()
    {
        var htmlContent = "<html><body><h1>Hello World</h1></body></html>";

        using var processor = await PdfProcessor.CreateAsync();
        var document = await processor.GeneratePdfFromHtmlStringAsync(htmlContent);
        await document.SaveAsync("output.pdf");
    }
}
Imports PSPDFKit.Pdf
Imports System.Threading.Tasks

Module Program
    Async Function Main() As Task
        Dim htmlContent As String = "<html><body><h1>Hello World</h1></body></html>"

        Using processor = Await PdfProcessor.CreateAsync()
            Dim document = Await processor.GeneratePdfFromHtmlStringAsync(htmlContent)
            Await document.SaveAsync("output.pdf")
        End Using
    End Function
End Module
$vbLabelText   $csharpLabel

IronPDF HTML 转 PDF 方法:

// NuGet: Install-Package IronPdf
using IronPdf;

class Program
{
    static void Main()
    {
        var htmlContent = "<html><body><h1>Hello World</h1></body></html>";

        var renderer = new ChromePdfRenderer();
        var pdf = renderer.RenderHtmlAsPdf(htmlContent);
        pdf.SaveAs("output.pdf");
    }
}
// NuGet: Install-Package IronPdf
using IronPdf;

class Program
{
    static void Main()
    {
        var htmlContent = "<html><body><h1>Hello World</h1></body></html>";

        var renderer = new ChromePdfRenderer();
        var pdf = renderer.RenderHtmlAsPdf(htmlContent);
        pdf.SaveAs("output.pdf");
    }
}
Imports IronPdf

Class Program
    Shared Sub Main()
        Dim htmlContent As String = "<html><body><h1>Hello World</h1></body></html>"

        Dim renderer As New ChromePdfRenderer()
        Dim pdf = renderer.RenderHtmlAsPdf(htmlContent)
        pdf.SaveAs("output.pdf")
    End Sub
End Class
$vbLabelText   $csharpLabel

Nutrient.io需要使用await PdfProcessor.CreateAsync()异步创建处理器,然后调用异步方法来生成和保存。 每个操作都使用async/await模式,正确的释放需要using语句。

IronPDF 默认提供同步方法,降低了代码的复杂性。 HTML到PDF转换工作流程包括实例化SaveAs()保存。 对于需要异步操作的应用程序,IronPDF还提供了像RenderHtmlAsPdfAsync()这样的异步方法变体。

Nutrient.io中的处理器生命周期需要通过using语句进行细致管理,而IronPDF的渲染器可以实例化并重用,不需要复杂的生命周期管理。

合并 PDF 文档

文档合并展示了这些库之间的 API 复杂性差异。

Nutrient.io 合并方法:

// NuGet: Install-Package PSPDFKit.Dotnet
using PSPDFKit.Pdf;
using System.Threading.Tasks;
using System.Collections.Generic;

class Program
{
    static async Task Main()
    {
        using var processor = await PdfProcessor.CreateAsync();

        var document1 = await processor.OpenAsync("document1.pdf");
        var document2 = await processor.OpenAsync("document2.pdf");

        var mergedDocument = await processor.MergeAsync(new List<PdfDocument> { document1, document2 });
        await mergedDocument.SaveAsync("merged.pdf");
    }
}
// NuGet: Install-Package PSPDFKit.Dotnet
using PSPDFKit.Pdf;
using System.Threading.Tasks;
using System.Collections.Generic;

class Program
{
    static async Task Main()
    {
        using var processor = await PdfProcessor.CreateAsync();

        var document1 = await processor.OpenAsync("document1.pdf");
        var document2 = await processor.OpenAsync("document2.pdf");

        var mergedDocument = await processor.MergeAsync(new List<PdfDocument> { document1, document2 });
        await mergedDocument.SaveAsync("merged.pdf");
    }
}
Imports PSPDFKit.Pdf
Imports System.Threading.Tasks
Imports System.Collections.Generic

Class Program
    Shared Async Function Main() As Task
        Using processor = Await PdfProcessor.CreateAsync()

            Dim document1 = Await processor.OpenAsync("document1.pdf")
            Dim document2 = Await processor.OpenAsync("document2.pdf")

            Dim mergedDocument = Await processor.MergeAsync(New List(Of PdfDocument) From {document1, document2})
            Await mergedDocument.SaveAsync("merged.pdf")
        End Using
    End Function
End Class
$vbLabelText   $csharpLabel

IronPDF 合并方式:

// NuGet: Install-Package IronPdf
using IronPdf;
using System.Collections.Generic;

class Program
{
    static void Main()
    {
        var pdf1 = PdfDocument.FromFile("document1.pdf");
        var pdf2 = PdfDocument.FromFile("document2.pdf");

        var merged = PdfDocument.Merge(pdf1, pdf2);
        merged.SaveAs("merged.pdf");
    }
}
// NuGet: Install-Package IronPdf
using IronPdf;
using System.Collections.Generic;

class Program
{
    static void Main()
    {
        var pdf1 = PdfDocument.FromFile("document1.pdf");
        var pdf2 = PdfDocument.FromFile("document2.pdf");

        var merged = PdfDocument.Merge(pdf1, pdf2);
        merged.SaveAs("merged.pdf");
    }
}
Imports IronPdf
Imports System.Collections.Generic

Class Program
    Shared Sub Main()
        Dim pdf1 = PdfDocument.FromFile("document1.pdf")
        Dim pdf2 = PdfDocument.FromFile("document2.pdf")

        Dim merged = PdfDocument.Merge(pdf1, pdf2)
        merged.SaveAs("merged.pdf")
    End Sub
End Class
$vbLabelText   $csharpLabel

Nutrient.io 要求 1.异步创建处理器 2.使用await processor.OpenAsync()异步打开每个文档 3.为合并操作创建一个List<PdfDocument> 4.调用异步MergeAsync()方法 5.异步保存结果

IronPDF将此过程简化为使用PdfDocument.Merge()方法。 PDF合并功能可直接接受多个文档,无需构建列表即可进行简单合并。

添加水印

水印揭示了基本设计理念的差异:Nutrient.io 使用注解对象,而IronPDF使用 HTML 字符串。

Nutrient.io 水印方法:

// NuGet: Install-Package PSPDFKit.Dotnet
using PSPDFKit.Pdf;
using PSPDFKit.Pdf.Annotation;
using System.Threading.Tasks;

class Program
{
    static async Task Main()
    {
        using var processor = await PdfProcessor.CreateAsync();
        var document = await processor.OpenAsync("document.pdf");

        for (int i = 0; i < document.PageCount; i++)
        {
            var watermark = new TextAnnotation("CONFIDENTIAL")
            {
                Opacity = 0.5,
                FontSize = 48
            };
            await document.AddAnnotationAsync(i, watermark);
        }

        await document.SaveAsync("watermarked.pdf");
    }
}
// NuGet: Install-Package PSPDFKit.Dotnet
using PSPDFKit.Pdf;
using PSPDFKit.Pdf.Annotation;
using System.Threading.Tasks;

class Program
{
    static async Task Main()
    {
        using var processor = await PdfProcessor.CreateAsync();
        var document = await processor.OpenAsync("document.pdf");

        for (int i = 0; i < document.PageCount; i++)
        {
            var watermark = new TextAnnotation("CONFIDENTIAL")
            {
                Opacity = 0.5,
                FontSize = 48
            };
            await document.AddAnnotationAsync(i, watermark);
        }

        await document.SaveAsync("watermarked.pdf");
    }
}
Imports PSPDFKit.Pdf
Imports PSPDFKit.Pdf.Annotation
Imports System.Threading.Tasks

Class Program
    Shared Async Function Main() As Task
        Using processor = Await PdfProcessor.CreateAsync()
            Dim document = Await processor.OpenAsync("document.pdf")

            For i As Integer = 0 To document.PageCount - 1
                Dim watermark = New TextAnnotation("CONFIDENTIAL") With {
                    .Opacity = 0.5,
                    .FontSize = 48
                }
                Await document.AddAnnotationAsync(i, watermark)
            Next

            Await document.SaveAsync("watermarked.pdf")
        End Using
    End Function
End Class
$vbLabelText   $csharpLabel

IronPDF 水印方法:

// NuGet: Install-Package IronPdf
using IronPdf;
using IronPdf.Editing;

class Program
{
    static void Main()
    {
        var pdf = PdfDocument.FromFile("document.pdf");

        pdf.ApplyWatermark("<h1 style='color:gray;opacity:0.5;'>CONFIDENTIAL</h1>",
            50,
            VerticalAlignment.Middle,
            HorizontalAlignment.Center);

        pdf.SaveAs("watermarked.pdf");
    }
}
// NuGet: Install-Package IronPdf
using IronPdf;
using IronPdf.Editing;

class Program
{
    static void Main()
    {
        var pdf = PdfDocument.FromFile("document.pdf");

        pdf.ApplyWatermark("<h1 style='color:gray;opacity:0.5;'>CONFIDENTIAL</h1>",
            50,
            VerticalAlignment.Middle,
            HorizontalAlignment.Center);

        pdf.SaveAs("watermarked.pdf");
    }
}
Imports IronPdf
Imports IronPdf.Editing

Class Program
    Shared Sub Main()
        Dim pdf = PdfDocument.FromFile("document.pdf")

        pdf.ApplyWatermark("<h1 style='color:gray;opacity:0.5;'>CONFIDENTIAL</h1>", 
                           50, 
                           VerticalAlignment.Middle, 
                           HorizontalAlignment.Center)

        pdf.SaveAs("watermarked.pdf")
    End Sub
End Class
$vbLabelText   $csharpLabel

Nutrient.io需要遍历每一页,使用await document.AddAnnotationAsync()异步添加每个注释。 这种方法需要了解注释 API 并手动迭代页面。

IronPDF 的水印功能使用带有 CSS 样式的 HTML 字符串。 ApplyWatermark()方法接受HTML内容、旋转角度和对齐参数,将水印自动应用于所有页面。 像color这样的CSS属性处理样式,否则需要单独的注释属性。

基于 HTML 的方法有以下几个优点:

  • 熟悉网络开发语法
  • 完整的 CSS 风格功能
  • 单一方法调用适用于所有页面
  • 无需人工迭页

API 映射参考

对于评估将 Nutrient.io 移植到IronPDF的团队来说,了解 API 映射有助于估算工作量。

核心方法映射

Nutrient.io (PSPDFKit)IronPDF
await PdfProcessor.CreateAsync()new ChromePdfRenderer()
await processor.OpenAsync(path)PdfDocument.FromFile(path)
await processor.GeneratePdfFromHtmlStringAsync(html)renderer.RenderHtmlAsPdf(html)
await processor.MergeAsync(docs)PdfDocument.Merge(pdfs)
await document.SaveAsync(path)pdf.SaveAs(path)
document.ToBytes()pdf.BinaryData
document.ToStream()pdf.Stream

配置映射

Nutrient.io (PSPDFKit)IronPDF
new PdfConfiguration { PageSize = ... }renderer.RenderingOptions.PaperSize = ...
config.Margins = new Margins(t, r, b, l)个别边距属性
config.Orientation = Orientation.LandscapeRenderingOptions.PaperOrientation

水印和注释映射

Nutrient.io (PSPDFKit)IronPDF
new TextAnnotation("text")HTML 字符串
annotation.Opacity = 0.5CSS opacity: 0.5
annotation.FontSize = 48CSS font-size: 48px
await document.AddAnnotationAsync(index, annotation)pdf.ApplyWatermark(html)

页眉/页脚映射

Nutrient.io (PSPDFKit)IronPDF
(复杂注释方法)RenderingOptions.HtmlHeader
(复杂注释方法)RenderingOptions.HtmlFooter
(手动计算页数){page}placeholder
(手动计算){total-pages}placeholder

Nutrient.io 需要手动计算页数并迭代,以便在页眉或页脚添加页码。IronPDF提供内置占位符,可自动插入页码和总计。

命名空间和软件包变更

从 Nutrient.io 迁移到IronPDF的团队需要更新命名空间导入:

Nutrient.io (PSPDFKit)IronPDF
using PSPDFKit.Pdf;using IronPdf;
using PSPDFKit.Pdf.Document;using IronPdf;
using PSPDFKit.Pdf.Rendering;using IronPdf.Rendering;
using PSPDFKit.Pdf.Annotation;using IronPdf;
using Nutrient.Pdf;using IronPdf;

NuGet 软件包迁移:

# Remove Nutrient/PSPDFKit packages
dotnet remove package PSPDFKit.NET
dotnet remove package PSPDFKit.PDF
dotnet remove package Nutrient
dotnet remove package Nutrient.PDF

# Install IronPDF
dotnet add package IronPdf
# Remove Nutrient/PSPDFKit packages
dotnet remove package PSPDFKit.NET
dotnet remove package PSPDFKit.PDF
dotnet remove package Nutrient
dotnet remove package Nutrient.PDF

# Install IronPDF
dotnet add package IronPdf
SHELL

同步与同步 API 设计

Nutrient.io 采用异步优先架构,几乎所有操作都需要Async/Await:

// Nutrient.io pattern - async everywhere
using var processor = await PdfProcessor.CreateAsync();
var document = await processor.OpenAsync(path);
await document.SaveAsync(outputPath);
// Nutrient.io pattern - async everywhere
using var processor = await PdfProcessor.CreateAsync();
var document = await processor.OpenAsync(path);
await document.SaveAsync(outputPath);
Imports System

Using processor = Await PdfProcessor.CreateAsync()
    Dim document = Await processor.OpenAsync(path)
    Await document.SaveAsync(outputPath)
End Using
$vbLabelText   $csharpLabel

IronPDF 默认提供同步方法,并提供异步替代方法:

//IronPDFsync pattern (simpler)
var pdf = PdfDocument.FromFile(path);
pdf.SaveAs(outputPath);

//IronPDFasync pattern (when needed)
var pdf = await renderer.RenderHtmlAsPdfAsync(html);
//IronPDFsync pattern (simpler)
var pdf = PdfDocument.FromFile(path);
pdf.SaveAs(outputPath);

//IronPDFasync pattern (when needed)
var pdf = await renderer.RenderHtmlAsPdfAsync(html);
' IronPDFsync pattern (simpler)
Dim pdf = PdfDocument.FromFile(path)
pdf.SaveAs(outputPath)

' IronPDFasync pattern (when needed)
Dim pdf = Await renderer.RenderHtmlAsPdfAsync(html)
$vbLabelText   $csharpLabel

对于 PDF 操作不需要异步的应用程序(如后台作业、控制台应用程序或同步服务方法),IronPDF 的默认同步 API 可降低代码的复杂性。 当 async 有益处时,可以使用这些方法。

团队何时考虑从 Nutrient.io 迁移到 IronPDF?

有几个因素促使团队将IronPDF作为 Nutrient.io 的替代品进行评估:

平台复杂性:只需要生成和处理 PDF 的团队可能会发现 Nutrient.io 的文档智能平台包含不必要的功能。 人工智能功能和文档工作流程功能为要求简单的项目增加了复杂性。

定价透明度: Nutrient.io 的企业定价需要联系销售部门获取报价,这使得预算规划变得复杂。 预算有限或需要可预测成本的组织可能更喜欢IronPDF的发布定价模式

API 简洁性: Nutrient.io 的异步优先设计要求在整个代码库中采用Async/Await模式,即使是简单的操作也是如此。 喜欢同步代码或希望在同步和异步之间灵活切换的团队都能从IronPDF的方法中受益。

品牌重塑带来的混乱: PSPDFKit 到 Nutrient.io 的过渡造成了文档碎片化,一些资源引用了旧名称和包装标识符。 遇到这种混淆的团队可能会寻求具有稳定命名的库。

集成简易性:创建处理器、管理生命周期和处理异步模式会增加集成开销。IronPDF直接的实例化和方法调用减少了新开发人员的上机时间。

水印实现: Nutrient.io 中的基于注释的水印需要页面迭代和注释对象创建。IronPDF基于 HTML 的方法利用了熟悉的网络开发技能,只需一次调用即可应用水印。

安装比较

Nutrient.io 安装:

Install-Package PSPDFKit.Dotnet
Install-Package PSPDFKit.Dotnet
SHELL

安装 IronPDF:

Install-Package IronPdf
Install-Package IronPdf
SHELL

IronPDF 需要在应用程序启动时配置许可证密钥:

IronPdf.License.LicenseKey = "YOUR-LICENSE-KEY";
IronPdf.License.LicenseKey = "YOUR-LICENSE-KEY";
IronPdf.License.LicenseKey = "YOUR-LICENSE-KEY"
$vbLabelText   $csharpLabel

这两个库都支持 .NET Framework 和现代 .NET 版本,因此与针对 .NET 10 和 C# 14 的应用程序兼容。

做出决定

在 Nutrient.io 和IronPDF之间做出选择取决于您的具体要求:

如果符合以下条件,请考虑使用 Nutrient.io:您的组织需要具有 AI 功能的完整文档智能平台,您的企业预算和采购流程与销售协商定价相匹配,并且您的应用程序架构已经完全采用异步优先模式。

如果您有以下需求,请考虑使用 IronPDF:您需要专注于 PDF 功能而不需要平台开销;您更喜欢透明的定价和更简单的采购方式;您希望在同步和异步 API 模式之间灵活切换;您更看重基于 HTML 的水印而不是注释对象;或者您想要内置的页眉/页脚占位符来显示页码。

对于在 2025 年构建现代 .NET 应用程序并计划在 2026 年实现这一目标的团队来说,评估实际所需的 PDF 功能与完整的平台功能有助于确定合适的工具。 许多项目发现,一个重点突出的 PDF 库可以满足他们的要求,而不需要复杂的文档智能平台。

开始使用 IronPDF

如需评估IronPDF是否满足您的 PDF 处理需求,请联系我们:

1.安装IronPDF NuGet packageInstall-Package IronPdf 2.查看 HTML 转 PDF 教程,了解基本转换模式

  1. 探索文档品牌化的水印功能 4.检查文档组装的IronPDF合并功能</a

IronPDF 教程为常见场景提供了全面的示例,API 参考记录了所有可用的类和方法。

结论

Nutrient.io 和IronPDF代表了在 .NET 应用程序中实现 PDF 功能的不同方法。 Nutrient.io 已经发展成为一个具有人工智能功能和企业定位的文档智能平台,而IronPDF则作为一个具有直接集成功能的专用 PDF 库,保持着专注。

对于需要 PDF 生成、操作、水印和合并而不需要额外平台功能的团队,IronPDF 的专注方法提供了更简单的 API、灵活的同步/同步模式和基于 HTML 的水印。 复杂性降低后,集成速度更快,维护更方便。

根据您的实际 PDF 要求、团队对 API 模式的偏好以及预算限制来评估这两种方案。 了解本比较中概述的架构差异将有助于您根据自己的 PDF 处理需求和开发实践做出明智的决定。

请注意Nutrient是其各自所有者的注册商标。 本网站与Nutrient或PSPDFKit无关联、未被认可或赞助。 所有产品名称、徽标和品牌均为各自所有者的财产。 比较仅供参考,反映撰写时公开可用的信息。)}]