跳過到頁腳內容
產品比較

IronPDF與PDFium.NET的比較

本次比較涵蓋了IronPDF和 PDFium.NET SDK 這兩個用於 PDF 創建、操作和渲染的 .NET 庫,比較內容包括架構、功能範圍和許可。 這兩個庫都可以創建和處理 PDF,但它們的渲染模型和 API 介面有很大不同。

什麼是 PDFium.NET?

PDFium.NET 用於建立、修改和檢視 PDF 檔案(可攜式文件格式)。 它提供了高階 C#/VB.NET API,用於在 Web 伺服器上動態建立 PDF,並在現有的 Desktop 或 Web 應用程式中實作 Save as PDF 功能。

PDFium.NET 的突出功能包括

  • 從零開始建立 PDF,或從掃描的影像集建立 PDF
  • 隨時可用的工具列,用於編輯、分割、合併和操作 PDF,包括文字萃取
  • 嵌入式獨立 Winforms 或 WPF PDF 檢視器控制項支援縮放
  • 支援 .NET 2.0+、.NET 6、Standard、Core、Mono、Microsoft Azure
  • 而且還能在 Windows XP 和 Mac OS 上運行。
  • 支援全部的 PDF 渲染功能
  • 基於高效能 PDF 檢視器,可搜尋、列印及編輯 PDF 檔案
  • 極快的文字處理引擎

IronPDF:核心特性與功能

IronPDF .NET PDF 程式庫是為開發人員設計的,特別是為 C# 開發人員設計的。 使用此 PDF 程式庫,您可以為 .NET 專案新增 PDF 檢視、產生和操作功能。

IronPDF 內建 Chromium 引擎,只需三行 C# 程式碼即可將 HTML 轉換為 PDF。 這不需要使用底層座標 API 來操作 PDF 檔案。 它可以處理 HTML 原始文件,例如 HTML 文件、JavaScript 文件和 ASPX 網頁,並且您可以透過一次方法呼叫將任何 HTML 字串直接渲染為 PDF

IronPDF 可以使用自訂的頁眉、頁腳、水印等自訂 PDF。 它還簡化了開發人員閱讀 PDF 文字和提取圖形的過程。

IronPDF for .NET 的突出功能包括:

  • 使用 HTML4/5、CSS 和 JavaScript 建立 PDF 文件
  • 使用自訂的網路登入憑證、使用者代理、代理人、cookies、HTTP 標頭和表單變數載入 URL。
  • 程式化完成 HTML/PDF 表格欄位。
  • 從 PDF 檔案中萃取文字和圖形
  • 以新內容更新 PDF 頁面。
  • 在 PDF 中加入並自訂頁首與頁尾。 -合併和拆分 PDF 文件
  • 將 ASP.NET 網頁表單轉換為可列印的 PDF。
  • 將 HTML 檔案/URL 轉換為 PDF。
  • 在不使用 Adobe Acrobat Reader 的情況下列印 PDF 檔案。

IronPDF 函式庫幾乎適用於所有與 C# 相容的作業系統和框架,包括以下:

  • .NET Core 2.1、3.0、3.1、.NET 5、6 和 7
  • 符合 .NET Standard 2.0 的通用相容性
  • Azure、AWS、Docker、Linux、Windows

下表總結了每個函式庫的優勢所在,然後再深入探討程式碼層面的細節。

特點 IronPDF PDFium.NET
HTML/URL 轉 PDF 是的(內建 Chromium 引擎) 不包含
從圖像/文字建立 PDF
PDF 合併 是的(支援頁面範圍選擇)
數位簽名 不包含
PDF 檢視器控制項(WinForms/WPF) 不包含
支援 .NET Core / .NET 5+
跨平台(Linux、macOS、Azure) Windows 和 macOS

若要測試IronPDF的 HTML 渲染和安全功能是否與 PDFium.NET 在您自己的專案中進行比較,可以使用 30 天免費試用版

文章的其他部分如下:

1.IronPDF C# 函式庫安裝 2.PDFium.NET SDK 安裝 3.建立 PDF 文件 4.從多個影像建立 PDF 5.數位簽署 PDF 6.定價與授權 7.總結

1.IronPDF C# 函式庫安裝。

IronPDF 函式庫有不同的下載與安裝方式。 最簡單的方法如下:

1.使用 Visual Studio 2.開發人員指令提示 3.直接下載 NuGet 套件 4.下載 IronPdf.DLL 函式庫

1.1.使用 Visual Studio

在您的 Visual Studio 專案中,從"工具"功能表或在解決方案總管中右擊您的專案,然後選擇"管理 NuGet 套件"。 這兩種選項的截圖如下所示。

IronPDF 與 PDFium.NET 的比較,圖 1:使用
圖 2:IronPDF 與 PDFium.NET 的比較:使用解決方案資源管理器存取 NuGet 套件管理器

打開 NuGet Package Manager 後,瀏覽IronPDF套件並進行安裝,如下截圖所示。

IronPDF 與 PDFium.NET 的比較,圖 3:使用 NuGet 套件管理器安裝IronPDF庫

1.2.使用開發人員指令提示。

IronPDF 也可透過 Developer Command Prompt 下載。 請遵循以下步驟:

  • 從"工具"功能表開啟 Developer Command Prompt 或套件管理員控制台
  • 鍵入以下指令:
Install-Package IronPdf
  • 按下 Enter 鍵
  • 這將會下載並安裝函式庫

1.3.直接下載 NuGet 套件。

IronPDF 也可透過造訪 NuGetIronPDF套件直接下載。 步驟如下

  • 尋找下載套件並點選。
  • 該套件將被下載並安裝。

1.4.透過下載函式庫安裝 IronPDF

您也可以直接從IronPDF的套件頁面下載 IronPdf.DLL 檔案

圖 4:IronPDF 與 PDFium.NET 的比較:從IronPDF網站下載IronPDF庫 DLL

使用以下步驟在您的專案中引用IronPDF函式庫:

  • 右鍵按一下解決方案總管中的解決方案,然後選取"參考資料
  • 瀏覽 IronPDF.dll 函式庫
  • 按一下確定!

全部完成! 下載並安裝 IronPDF。 現在我們將安裝 PDFium.NET SDK 函式庫。

2. PDFium.NET 安裝。

我們可以使用 NuGet 套件管理員或下載 PDFium Windows 安裝程式來安裝 PDFium.NET。

  • 在 Visual Studio 中打開 NuGet 套件,就像我們在IronPDF中做的一樣。
  • 搜尋 PDFium.NET.SDK。 在您目前的專案中按一下安裝。
IronPDF 與 PDFium.NET 的比較,圖 5:PDFium.NET 搜尋
  • 您也可以使用套件管理員控制台進行安裝。 按照IronPDF所述的"使用開發人員指令提示"步驟,輸入下列指令:
Install-Package Pdfium.Net.SDK
  • 請按 Enter。 這將會下載並安裝函式庫。

3.建立 PDF 文件

3.1.使用 IronPDF

IronPDF 提供多種產生 PDF 檔案的方法。 讓我們來看看兩個重要的。

將現有 URL 轉換成 PDF

IronPDF 使用其內建的 Chromium 渲染引擎,直接將現有 URL 轉換為 PDF

請考慮下列原始碼。

IronPdf.ChromePdfRenderer Renderer = new IronPdf.ChromePdfRenderer();

// Use RenderUrlAsPdf method to convert a given URL to a PDF document
using var Pdf = Renderer.RenderUrlAsPdf("https://ironpdf.com/");

// Save the generated PDF document
Pdf.SaveAs("url.pdf");
IronPdf.ChromePdfRenderer Renderer = new IronPdf.ChromePdfRenderer();

// Use RenderUrlAsPdf method to convert a given URL to a PDF document
using var Pdf = Renderer.RenderUrlAsPdf("https://ironpdf.com/");

// Save the generated PDF document
Pdf.SaveAs("url.pdf");
Dim Renderer As New IronPdf.ChromePdfRenderer()

' Use RenderUrlAsPdf method to convert a given URL to a PDF document
Dim Pdf = Renderer.RenderUrlAsPdf("https://ironpdf.com/")

' Save the generated PDF document
Pdf.SaveAs("url.pdf")
$vbLabelText   $csharpLabel

HTML 輸入字串至 PDF

以下程式碼片段顯示如何使用 HTML 字串來呈現 PDF 頁面。 您可以使用簡單的 HTML,或將其與 CSS、圖像和在轉換之前執行的 JavaScript 內容結合。

var Renderer = new IronPdf.ChromePdfRenderer();

// Render HTML as a PDF
using var PDF = Renderer.RenderHtmlAsPdf("<h1>Html with CSS and Images</h1>");
PDF.SaveAs("pixel-perfect.pdf");

// Load external HTML assets: images, css, and javascript
// An optional BasePath 'C:\site\assets\' is set as the file location to load assets from
using var AdvancedPDF = Renderer.RenderHtmlAsPdf("<img src='logo_square.png'>", @"e:\site\assets\");
AdvancedPDF.SaveAs("html-with-assets.pdf");
var Renderer = new IronPdf.ChromePdfRenderer();

// Render HTML as a PDF
using var PDF = Renderer.RenderHtmlAsPdf("<h1>Html with CSS and Images</h1>");
PDF.SaveAs("pixel-perfect.pdf");

// Load external HTML assets: images, css, and javascript
// An optional BasePath 'C:\site\assets\' is set as the file location to load assets from
using var AdvancedPDF = Renderer.RenderHtmlAsPdf("<img src='logo_square.png'>", @"e:\site\assets\");
AdvancedPDF.SaveAs("html-with-assets.pdf");
Imports IronPdf

Dim Renderer As New ChromePdfRenderer()

' Render HTML as a PDF
Using PDF = Renderer.RenderHtmlAsPdf("<h1>Html with CSS and Images</h1>")
    PDF.SaveAs("pixel-perfect.pdf")
End Using

' Load external HTML assets: images, css, and javascript
' An optional BasePath 'C:\site\assets\' is set as the file location to load assets from
Using AdvancedPDF = Renderer.RenderHtmlAsPdf("<img src='logo_square.png'>", "e:\site\assets\")
    AdvancedPDF.SaveAs("html-with-assets.pdf")
End Using
$vbLabelText   $csharpLabel

輸出內容如下:

圖 6:IronPDF 與 PDFium.NET 的比較:IronPDF 從 URL 和 HTML 字串產生 PDF

3.2.使用 PDFium.NET

PDFium.NET 使用影像和文字物件即時產生 PDF 文件。 它的渲染管道是圍繞底層頁面合成而不是基於 HTML 的轉換構建的,因此 URL 和 HTML 字串到 PDF 的工作流程不在其當前範圍內。

以下是使用建立 PDFium.NET 產生 PDF 的範例程式碼:

public void CreatePDF()
{
    // Step 1: Initialize PDF library and create an empty document
    PdfCommon.Initialize();
    var doc = PdfDocument.CreateNew();  // Create a new PDF document

    // Step 2: Add a new page
    // Arguments: page width: 8.27", page height: 11.69", Unit of measure: inches
    //  The PDF unit of measure is a point. There are 72 points in one inch.
    var page = doc.Pages.InsertPageAt(doc.Pages.Count, 8.27f * 72, 11.69f * 72);

    // Step 3: Add graphics and text contents to the page
    // Insert image from file using the standard System.Drawing.Bitmap class
    using (PdfBitmap logo = PdfBitmap.FromFile(@"e:\site\assets\logo_square.png"))
    {
        PdfImageObject imageObject = PdfImageObject.Create(doc, logo, 0, 0);
        // Set image resolution to 300 DPI and location to 1.69 x 10.0 inches
        imageObject.Matrix = new FS_MATRIX(logo.Width * 72 / 300, 0, 0, logo.Height * 72 / 300, 1.69 * 72, 10.0 * 72);
        page.PageObjects.Add(imageObject);
    }

    // Create fonts for text objects
    PdfFont calibryBold = PdfFont.CreateFont(doc, "CalibriBold");
    // Insert text objects at 7.69"; 11.02" and font size is 25
    PdfTextObject textObject = PdfTextObject.Create("Sample text", 7.69f * 72, 11.02f * 72, calibryBold, 25);
    textObject.FillColor = FS_COLOR.Black;
    page.PageObjects.Add(textObject);

    // Step 5: Generate page content and save PDF file
    // Argument: PDF file name
    page.GenerateContent();
    doc.Save(@"e:\site\sample_document.pdf", SaveFlags.NoIncremental);
}
public void CreatePDF()
{
    // Step 1: Initialize PDF library and create an empty document
    PdfCommon.Initialize();
    var doc = PdfDocument.CreateNew();  // Create a new PDF document

    // Step 2: Add a new page
    // Arguments: page width: 8.27", page height: 11.69", Unit of measure: inches
    //  The PDF unit of measure is a point. There are 72 points in one inch.
    var page = doc.Pages.InsertPageAt(doc.Pages.Count, 8.27f * 72, 11.69f * 72);

    // Step 3: Add graphics and text contents to the page
    // Insert image from file using the standard System.Drawing.Bitmap class
    using (PdfBitmap logo = PdfBitmap.FromFile(@"e:\site\assets\logo_square.png"))
    {
        PdfImageObject imageObject = PdfImageObject.Create(doc, logo, 0, 0);
        // Set image resolution to 300 DPI and location to 1.69 x 10.0 inches
        imageObject.Matrix = new FS_MATRIX(logo.Width * 72 / 300, 0, 0, logo.Height * 72 / 300, 1.69 * 72, 10.0 * 72);
        page.PageObjects.Add(imageObject);
    }

    // Create fonts for text objects
    PdfFont calibryBold = PdfFont.CreateFont(doc, "CalibriBold");
    // Insert text objects at 7.69"; 11.02" and font size is 25
    PdfTextObject textObject = PdfTextObject.Create("Sample text", 7.69f * 72, 11.02f * 72, calibryBold, 25);
    textObject.FillColor = FS_COLOR.Black;
    page.PageObjects.Add(textObject);

    // Step 5: Generate page content and save PDF file
    // Argument: PDF file name
    page.GenerateContent();
    doc.Save(@"e:\site\sample_document.pdf", SaveFlags.NoIncremental);
}
Public Sub CreatePDF()
	' Step 1: Initialize PDF library and create an empty document
	PdfCommon.Initialize()
	Dim doc = PdfDocument.CreateNew() ' Create a new PDF document

	' Step 2: Add a new page
	' Arguments: page width: 8.27", page height: 11.69", Unit of measure: inches
	'  The PDF unit of measure is a point. There are 72 points in one inch.
	Dim page = doc.Pages.InsertPageAt(doc.Pages.Count, 8.27F * 72, 11.69F * 72)

	' Step 3: Add graphics and text contents to the page
	' Insert image from file using the standard System.Drawing.Bitmap class
	Using logo As PdfBitmap = PdfBitmap.FromFile("e:\site\assets\logo_square.png")
		Dim imageObject As PdfImageObject = PdfImageObject.Create(doc, logo, 0, 0)
		' Set image resolution to 300 DPI and location to 1.69 x 10.0 inches
		imageObject.Matrix = New FS_MATRIX(logo.Width * 72 \ 300, 0, 0, logo.Height * 72 \ 300, 1.69 * 72, 10.0 * 72)
		page.PageObjects.Add(imageObject)
	End Using

	' Create fonts for text objects
	Dim calibryBold As PdfFont = PdfFont.CreateFont(doc, "CalibriBold")
	' Insert text objects at 7.69"; 11.02" and font size is 25
	Dim textObject As PdfTextObject = PdfTextObject.Create("Sample text", 7.69F * 72, 11.02F * 72, calibryBold, 25)
	textObject.FillColor = FS_COLOR.Black
	page.PageObjects.Add(textObject)

	' Step 5: Generate page content and save PDF file
	' Argument: PDF file name
	page.GenerateContent()
	doc.Save("e:\site\sample_document.pdf", SaveFlags.NoIncremental)
End Sub
$vbLabelText   $csharpLabel

輸出內容如下:

IronPDF 與 PDFium.NET 的比較,圖 7:PDFium.NET 產生 PDF

比較兩種輸出方式,IronPDF 的 HTML 渲染方法可以自動處理影像放置-無需手動縮放,必要時還可以將獨立影像直接轉換為 PDF 文件。 PDFium.NET 也能產生類似的結果,但它依賴明確的影像縮放程式碼來正確定位內容。 如果我們跳過程式碼中的以下一行:

imageObject.Matrix = new FS_MATRIX(logo.Width * 72 / 300, 0, 0, logo.Height * 72 / 300, 1.69 * 72, 10.0 * 72);
imageObject.Matrix = new FS_MATRIX(logo.Width * 72 / 300, 0, 0, logo.Height * 72 / 300, 1.69 * 72, 10.0 * 72);
imageObject.Matrix = New FS_MATRIX(logo.Width * 72 \ 300, 0, 0, logo.Height * 72 \ 300, 1.69 * 72, 10.0 * 72)
$vbLabelText   $csharpLabel

輸出內容將包括

IronPDF 與 PDFium.NET 的比較,圖 8:PDFium.NET 輸出(未進行影像縮放)PDF

4.從多個影像建立 PDF.

4.1.使用 IronPDF

在IronPDF中,合併兩個或多個 PDF 十分容易。 使用 Merge 方法,您可以合併兩個或多個 PDF 文件,其中每個文件以逗號分隔。 代碼如下:

using IronPdf;

var html_a = @"<p> [PDF_A] </p>
                <p> [PDF_A] 1st Page </p>
                <div style = 'page-break-after: always;'></div>
                <p> [PDF_A] 2nd Page</p>";

var html_b = @"<p> [PDF_B] </p>
                <p> [PDF_B] 1st Page </p>
                <div style = 'page-break-after: always;'></div>
                <p> [PDF_B] 2nd Page</p>";

var Renderer = new IronPdf.ChromePdfRenderer();

// Render HTML documents as PDFs
var pdfdoc_a = Renderer.RenderHtmlAsPdf(html_a);
var pdfdoc_b = Renderer.RenderHtmlAsPdf(html_b);

// Merge the documents into one PDF
var merged = IronPdf.PdfDocument.Merge(pdfdoc_a, pdfdoc_b);

// Save the merged document
merged.SaveAs("Merged.PDF");
using IronPdf;

var html_a = @"<p> [PDF_A] </p>
                <p> [PDF_A] 1st Page </p>
                <div style = 'page-break-after: always;'></div>
                <p> [PDF_A] 2nd Page</p>";

var html_b = @"<p> [PDF_B] </p>
                <p> [PDF_B] 1st Page </p>
                <div style = 'page-break-after: always;'></div>
                <p> [PDF_B] 2nd Page</p>";

var Renderer = new IronPdf.ChromePdfRenderer();

// Render HTML documents as PDFs
var pdfdoc_a = Renderer.RenderHtmlAsPdf(html_a);
var pdfdoc_b = Renderer.RenderHtmlAsPdf(html_b);

// Merge the documents into one PDF
var merged = IronPdf.PdfDocument.Merge(pdfdoc_a, pdfdoc_b);

// Save the merged document
merged.SaveAs("Merged.PDF");
Imports IronPdf

Dim html_a As String = "<p> [PDF_A] </p>
                <p> [PDF_A] 1st Page </p>
                <div style = 'page-break-after: always;'></div>
                <p> [PDF_A] 2nd Page</p>"

Dim html_b As String = "<p> [PDF_B] </p>
                <p> [PDF_B] 1st Page </p>
                <div style = 'page-break-after: always;'></div>
                <p> [PDF_B] 2nd Page</p>"

Dim Renderer As New IronPdf.ChromePdfRenderer()

' Render HTML documents as PDFs
Dim pdfdoc_a = Renderer.RenderHtmlAsPdf(html_a)
Dim pdfdoc_b = Renderer.RenderHtmlAsPdf(html_b)

' Merge the documents into one PDF
Dim merged = IronPdf.PdfDocument.Merge(pdfdoc_a, pdfdoc_b)

' Save the merged document
merged.SaveAs("Merged.PDF")
$vbLabelText   $csharpLabel

4.2.使用 PDFium.NET

使用 PDFium.NET,您不僅可以將多個 PDF 檔案合併為單一檔案,還可以從原始檔案中選取特定頁面合併為一個 PDF 文件。

以下程式碼展示如何使用 ImportPages 方法實作:

public void MergePDF()
{
    // Initialize the SDK library.
    PdfCommon.Initialize();

    // Open and load a PDF document into which other files will be merged 
    using (var mainDoc = PdfDocument.Load(@"c:\test001.pdf")) // Read source PDF File #1
    {
        // Open one PDF document.
        using (var doc = PdfDocument.Load(@"c:\doc1.pdf")) // Read PDF File #2
        {
            // Import all pages from the document
            mainDoc.Pages.ImportPages(
                doc,
                string.Format("1-{0}", doc.Pages.Count),
                mainDoc.Pages.Count
                );
        }

        // Open another PDF document.
        using (var doc = PdfDocument.Load(@"c:\doc2.pdf"))
        {
            // Import all pages from the document
            mainDoc.Pages.ImportPages(
                doc,
                string.Format("1-{0}", doc.Pages.Count),
                mainDoc.Pages.Count
                );
        }

        // Save the merged document
        mainDoc.Save(@"c:\ResultDocument.pdf", SaveFlags.NoIncremental);
    }
}
public void MergePDF()
{
    // Initialize the SDK library.
    PdfCommon.Initialize();

    // Open and load a PDF document into which other files will be merged 
    using (var mainDoc = PdfDocument.Load(@"c:\test001.pdf")) // Read source PDF File #1
    {
        // Open one PDF document.
        using (var doc = PdfDocument.Load(@"c:\doc1.pdf")) // Read PDF File #2
        {
            // Import all pages from the document
            mainDoc.Pages.ImportPages(
                doc,
                string.Format("1-{0}", doc.Pages.Count),
                mainDoc.Pages.Count
                );
        }

        // Open another PDF document.
        using (var doc = PdfDocument.Load(@"c:\doc2.pdf"))
        {
            // Import all pages from the document
            mainDoc.Pages.ImportPages(
                doc,
                string.Format("1-{0}", doc.Pages.Count),
                mainDoc.Pages.Count
                );
        }

        // Save the merged document
        mainDoc.Save(@"c:\ResultDocument.pdf", SaveFlags.NoIncremental);
    }
}
Public Sub MergePDF()
	' Initialize the SDK library.
	PdfCommon.Initialize()

	' Open and load a PDF document into which other files will be merged 
	Using mainDoc = PdfDocument.Load("c:\test001.pdf") ' Read source PDF File #1
		' Open one PDF document.
		Using doc = PdfDocument.Load("c:\doc1.pdf") ' Read PDF File #2
			' Import all pages from the document
			mainDoc.Pages.ImportPages(doc, String.Format("1-{0}", doc.Pages.Count), mainDoc.Pages.Count)
		End Using

		' Open another PDF document.
		Using doc = PdfDocument.Load("c:\doc2.pdf")
			' Import all pages from the document
			mainDoc.Pages.ImportPages(doc, String.Format("1-{0}", doc.Pages.Count), mainDoc.Pages.Count)
		End Using

		' Save the merged document
		mainDoc.Save("c:\ResultDocument.pdf", SaveFlags.NoIncremental)
	End Using
End Sub
$vbLabelText   $csharpLabel

5.以數位方式簽署 PDF

5.1.使用 IronPDF

如今最重要的功能之一是使用 PFX 憑證對 PDF 文件進行數位簽章。IronPDF提供了這種便利。 代碼如下:

using IronPdf;

// Cryptographically sign an existing PDF in 1 line of code!
new IronPdf.Signing.PdfSignature("Iron.p12", "123456").SignPdfFile("any.pdf");

/***** Advanced example for more control *****/

// Step 1. Create a PDF
var Renderer = new IronPdf.ChromePdfRenderer();
var doc = Renderer.RenderHtmlAsPDF("<h1>Testing 2048 bit digital security</h1>");

// Step 2. Create a Signature.
// You may create a .pfx or .p12 PDF signing certificate using Adobe Acrobat Reader.

var signature = new IronPdf.Signing.PdfSignature("Iron.pfx", "123456");

// Step 3. Handwritten signature graphic
signature.LoadSignatureImageFromFile("handwriting.png");

// Step 4. Sign the PDF with the PDFSignature. Multiple signing certificates may be used
doc.SignPdfWithDigitalSignature(signature);

// Step 4. The PDF is not signed until saved to file, stream, or byte array.
doc.SaveAs("signed.pdf"); 
using IronPdf;

// Cryptographically sign an existing PDF in 1 line of code!
new IronPdf.Signing.PdfSignature("Iron.p12", "123456").SignPdfFile("any.pdf");

/***** Advanced example for more control *****/

// Step 1. Create a PDF
var Renderer = new IronPdf.ChromePdfRenderer();
var doc = Renderer.RenderHtmlAsPDF("<h1>Testing 2048 bit digital security</h1>");

// Step 2. Create a Signature.
// You may create a .pfx or .p12 PDF signing certificate using Adobe Acrobat Reader.

var signature = new IronPdf.Signing.PdfSignature("Iron.pfx", "123456");

// Step 3. Handwritten signature graphic
signature.LoadSignatureImageFromFile("handwriting.png");

// Step 4. Sign the PDF with the PDFSignature. Multiple signing certificates may be used
doc.SignPdfWithDigitalSignature(signature);

// Step 4. The PDF is not signed until saved to file, stream, or byte array.
doc.SaveAs("signed.pdf"); 
Imports IronPdf

' Cryptographically sign an existing PDF in 1 line of code!
Call New IronPdf.Signing.PdfSignature("Iron.p12", "123456").SignPdfFile("any.pdf")

'/***** Advanced example for more control *****/

' Step 1. Create a PDF
Dim Renderer As New IronPdf.ChromePdfRenderer()
Dim doc = Renderer.RenderHtmlAsPdf("<h1>Testing 2048 bit digital security</h1>")

' Step 2. Create a Signature.
' You may create a .pfx or .p12 PDF signing certificate using Adobe Acrobat Reader.

Dim signature = New IronPdf.Signing.PdfSignature("Iron.pfx", "123456")

' Step 3. Handwritten signature graphic
signature.LoadSignatureImageFromFile("handwriting.png")

' Step 4. Sign the PDF with the PDFSignature. Multiple signing certificates may be used
doc.SignPdfWithDigitalSignature(signature)

' Step 4. The PDF is not signed until saved to file, stream, or byte array.
doc.SaveAs("signed.pdf")
$vbLabelText   $csharpLabel

數位簽章不在 PDFium.NET 的當前範圍內,因此需要此功能的團隊需要整合額外的庫,或評估像IronPDF這樣將其作為一項主要操作的工具。

6.定價與授權。

IronPDF定價與授權

IronPDF 可免費用於開發簡單的應用程式,並可隨時取得商業使用授權。它提供單一專案授權、單一開發人員授權、代理商和跨國組織授權。 該公司還提供 SaaS 和 OEM 再發行授權與支援。

所有IronPDFLicense 均提供 30 天退款保證,以及一年的軟體支援與升級服務。 最重要的是,這是一項永久授權(一次性購買)。 提供 Lite 套件。IronPDF產品絕無經常性費用。 有關可用授權的詳細資訊,請參閱 IronPDF授權頁面

A Comparison betweenIronPDFand PDFium.NET, Figure 9:IronPDFLicensing

PDFium.NET 定價與授權

PDFium.NET 提供永久授權。 您可以憑註冊密鑰永久使用此支援的 SDK 版本。 然而,該密鑰僅適用於某些特定的 SDK 版本,這些版本取決於購買或更新授權的日期。 您可以免費安裝任何新的產品版本,只要該版本是在您購買之前或一年內發佈的。 PDFium.NET 也提供 3 種不同的授權套件:

  • 單一專案授權是專為單一開發人員和負責一個專案的小型團隊所設計。 720 美元起。
  • Organization License 專為負責多個專案的開發團隊所設計。
  • 單一開發人員授權專為為多位客戶工作的單一開發人員和自由工作者所設計。

您可以造訪PDFium.NET購買頁面,取得完整的價格細節。

除了授權費用之外,專案總成本還包括開發人員在基於座標的頁面佈局、手動圖像縮放以及整合數位簽名和 HTML 到 PDF 轉換等功能所需的單獨庫上花費的時間。 對於評估多年專案生命週期成本的團隊來說,這些整合和維護時間往往會超過兩個庫標價之間的差額。

您應該選擇哪一個程式庫?

IronPDF 提供了一個高級 API,可以從頭開始建立 PDF 文檔,而無需基於座標的佈局程式碼。 它內建的 Chromium 引擎可以將 HTML、JS、CSS、JPG、PNG、GIF 和 SVG 轉換為 PDF,並完全支援 CSS3 和現代佈局。

PDFium.NET SDK 是一個 .NET 類函式庫,以合理的價格滿足開發人員最常見的需求。有了 PDFium.NET SDK,您的應用程式就可以輕鬆顯示和處理 PDF 文件。 其特殊的頁面物件編輯 API 是這個函式庫特別強大的地方。

如上所述,PDFium.NET 授權有三種版本。 單一專案授權可提供給單一開發人員和最多三名開發人員使用,起價分別為 720 美元和 900 美元。 這比IronPDF便宜一些,IronPDF 的 Lite 版本起價較低。

IronPDF 提供價格極具競爭力的無限量許可證,而 PDFium.NET 則提供更高級別的組織許可證,可供無限數量的開發人員使用。 對於中型團隊而言,IronPDF 的專業版授權最多可供 10 位開發人員使用,價格約為 PDFium.NET 同類產品的一半。

在上面的範例中,與 PDFium.NET 相比,IronPDF 使用更少的程式碼行建立和修改 PDF 文件——例如,HTML 到 PDF 的轉換只需 3 行程式碼,而 PDFium.NET 基於座標的方法需要大約 20 行程式碼才能獲得類似的結果。IronPDF提供多種方法,可將 HTML、URL 和 ASPX 頁面等格式轉換為 PDF。 PDFium.NET 專注於基於圖像和文字的合成,這使得開發人員可以更精細地控制頁面佈局,但對於常見的轉換任務需要更多的人工操作。

您現在可以 購買 Iron Software 的所有產品資料庫,只需花費兩個產品資料庫的價錢。 此外,還有免費試用來測試功能。

請注意PDFium.NET 是其各自所有者的註冊商標。 本網站與 PDFium.NET 無任何關聯、背書或贊助。 所有產品名稱、標誌和品牌均為其各自擁有者的財產。 比較僅供參考,反映了撰寫時的公開信息。

常見問題解答

怎樣在 C# 中將 HTML 轉換為 PDF?

您可以使用 IronPDF 的 RenderHtmlAsPdf 方法將 HTML 字串轉換為 PDF。此外,您可以使用 RenderHtmlFileAsPdf 方法將 HTML 文件轉換為 PDF。

IronPDF 用於 PDF 處理的主要功能是什麼?

IronPDF 允許開發人員使用 HTML、CSS 和 JavaScript 創建 PDF 文件。 它具有 URL 到 PDF 的轉換、文字和圖形提取、自定義頁眉和頁腳、PDF 合併和分割,與無需 Adobe Acrobat Reader 打印 PDF 的功能。

IronPDF 能夠對 PDF 文件進行數位簽名嗎?

是的,IronPDF 支援數位簽名,允許您使用加密簽名來保護 PDF 文件。

IronPDF 的安裝選項有哪些?

IronPDF 可以通過 Visual Studio、開發者命令提示符,或者通過下載 NuGet 包,或獲取 IronPdf.DLL 庫進行安裝。

IronPDF 提供哪些授權和定價選項?

IronPDF 提供多種授權選項,包括單項目、單開發人員、代理機構和跨國機構的許可證,還提供 SaaS 和 OEM 再分發許可證,並提供 30 天退款保證。

IronPDF 如何提高開發效率?

IronPDF 專為創建和修改 PDF 文件所需代碼行數少於其他庫如 PDFium.NET 設計,提升了開發人員的生產力。

IronPDF 是否支援跨平台 PDF 功能?

是的,IronPDF 支援多個操作系統和框架,使其成為跨平台 PDF 功能的多功能選擇。

使用 IronPDF 勝過其他 PDF 庫的優勢是什麼?

IronPDF 提供易用性、如 HTML 到 PDF 轉換的強大功能集以及具有競爭力的定價,與其他 PDF 庫相比,它是許多開發人員的首選。

Curtis Chau
技術作家

Curtis Chau 擁有卡爾頓大學計算機科學學士學位,專注於前端開發,擅長於 Node.js、TypeScript、JavaScript 和 React。Curtis 熱衷於創建直觀且美觀的用戶界面,喜歡使用現代框架並打造結構良好、視覺吸引人的手冊。

除了開發之外,Curtis 對物聯網 (IoT) 有著濃厚的興趣,探索將硬體和軟體結合的創新方式。在閒暇時間,他喜愛遊戲並構建 Discord 機器人,結合科技與創意的樂趣。

鋼鐵支援團隊

我們每週 5 天,每天 24 小時在線上。
聊天
電子郵件
打電話給我