比較

Nutrient.io vs IronPDF:技術比較指南

當 .NET 開發人員需要 PDF 處理功能時,他們經常會遇到 Nutrient.io(以前稱為 PSPDFKit)——該平台已從 PDF SDK 轉型為完整的文件智慧解決方案。 本文將從關鍵技術方面對 Nutrient.io 和IronPDF進行比較,以協助開發人員、架構師和技術決策者為其 PDF 產生和處理工作流程選擇合適的工具。

什麼是 Nutrient.io?

Nutrient.io(前身為 PSPDFKit)已從一個以 PDF 為中心的庫轉變為一個完整的文檔智慧平台。 這項變更使其功能不再局限於簡單的 PDF 處理,而是擴展到包括 AI 驅動的文件分析和廣泛的文件工作流程功能。

該函式庫透過 PdfProcessor 類運作,必須使用 PdfProcessor.CreateAsync() 以異步方式建立。 HTML 到 PDF 的轉換、文件合併和水印等作業都透過 GeneratePdfFromHtmlStringAsync(), MergeAsync()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 風格同步為先、複雜同步與同步選項
學習曲線Steep (平台)溫和

Nutrient.io 的平台方法意味著即使只需要基本的 PDF 操作,應用程式也能獲得 AI 功能和文件工作流程功能。 這可能會為要求簡單的專案帶來不必要的複雜性。

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-to-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 要求使用等待 PdfProcessor.CreateAsync()。以異步方式創建處理器,然後調用異步方法進行生成和儲存。 每個操作都使用 async/await 模式,正確的處理需要 using 語句。

IronPDF 預設提供同步方法,可降低程式碼的複雜性。 HTML轉換為PDF的工作流程包括實體化ChromePdfRenderer、呼叫RenderHtmlAsPdf(),以及使用SaveAs()儲存。 對於需要執行 async 作業的應用程式,IronPDF 也提供了 async 方法的變體,例如 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.呼叫 async MergeAsync() 方法 5.異步儲存結果

IronPDF 將此簡化為使用 PdfDocument.FromFile() 載入檔案,並呼叫靜態 PdfDocument.Merge() 方法。 IronPDF合併功能可直接接受多個文件,而不需要為簡單的合併建立清單。

新增水印。

水印揭示了基本設計理念的差異: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 需要遍歷每個頁面,建立 TextAnnotation 物件,這些物件具有 OpacityFontSize 等屬性,並使用 await document.AddAnnotationAsync() 以異步方式新增每個註解。 此方法需要瞭解註解 API 並手動迭代頁面。

IronPDF 的浮水印功能使用帶有 CSS 樣式的 HTML 字串。 ApplyWatermark() 方法接受 HTML 內容、旋轉角度和對齊參數,自動將水印套用至所有頁面。 CSS 屬性如 opacitycolor 可處理原本需要獨立註解屬性才能處理的樣式。

基於 HTML 的方法提供了幾個優點:

  • 熟悉的網路開發語法
  • 完整的 CSS 設定功能
  • 單一方法呼叫適用於所有頁面
  • 無須手動迭代頁面

API 對應參考。

對於評估將 Nutrient.io 移轉至IronPDF的團隊而言,瞭解 API 對應有助於估算工作量。

核心方法對應

Nutrient.io (PSPDFKit)IronPDF
等待 PdfProcessor.CreateAsync()新的 ChromePdfRenderer()
等待處理器.OpenAsync(路徑)PdfDocument.FromFile(path)
await processor.GeneratePdfFromHtmlStringAsync(html)renderer.RenderHtmlAsPdf(html)
await processor.MergeAsync(docs)PdfDocument.Merge(pdfs)
await document.SaveAsync(path)pdf.SaveAs(路徑)
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 不透明度: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}占位符
(手動計算){total-pages}占位符

Nutrient.io 需要手動計頁和迭代,以便在頁首或頁尾加入頁數。IronPDF提供內建佔位符,可自動插入頁碼和總計。

命名空間與套件變更

從 Nutrient.io 遷移到IronPDF的團隊需要更新命名空間的匯入:

Nutrient.io (PSPDFKit)IronPDF
使用 PSPDFKit.Pdf;使用 IronPdf;
使用 PSPDFKit.Pdf.Document;使用 IronPdf;
使用 PSPDFKit.Pdf.Rendering;使用 IronPdf.Rendering;
使用 PSPDFKit.Pdf.Annotation;使用 IronPdf;
使用 Nutrient.Pdf;使用 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

Async vs Sync API 設計

Nutrient.io 採用 async-first 架構,幾乎每個操作都需要 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 的文檔智慧平台包含不必要的功能。 AI 功能和文件工作流程功能增加了要求簡單的專案的複雜性。

價格透明度: Nutrient.io 的企業定價需要聯繫銷售部門以取得報價,這使得預算規劃變得複雜。 預算有限的組織或需要可預測成本的組織可能會偏好IronPDF的 公開定價模式

API 簡潔性: Nutrient.io 的非同步優先設計要求在整個程式碼庫中採用非同步/等待模式,即使是簡單的操作也是如此。 喜歡同步程式碼或希望在同步與非同步之間靈活變通的團隊,都能從 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 套件Install-Package IronPdf。 2.檢閱 HTML 至 PDF 教程,瞭解基本的轉換模式

  1. 探索文件品牌浮水印功能 4.檢查文件組裝的IronPDF合併功能</a

IronPDF教學提供了常見情境的全面範例,而API參考則記錄了所有可用的類別和方法。

結論

Nutrient.io 和IronPDF代表了 .NET 應用程式中 PDF 功能的不同方法。 Nutrient.io 已經發展成為一個具有 AI 功能和企業定位的文件智慧平台,而IronPDF則維持專注,成為一個具有直接整合功能的專用 PDF 函式庫。

對於需要 PDF 產生、處理、水印和合併,但不需要額外平台功能的團隊而言,IronPDF 的專注方法提供了更簡單的 API、彈性的同步/不同步模式,以及基於 HTML 的水印。 複雜性降低後,整合速度會更快,維護也會更容易。

根據您的實際 PDF 需求、團隊對 API 模式的偏好以及預算限制來評估這兩個選項。 了解本比較中概述的架構差異,將有助於您做出符合 PDF 處理需求和開發實務的明智決策。