跳至頁尾內容
產品比較

Telerik的HTML到PDF生成器與IronPDF

這個比較涵蓋了IronPDF和PDFium.NET SDK——兩個用於PDF建立、操縱和渲染的.NET程式庫——在架構、功能範圍和授權上的對比。 這兩個程式庫都可以建立和處理PDF,但它們的渲染模型和API表面有顯著不同。

什麼是PDFium.NET?

PDFium.NET用於建立、修改和查看檔案為PDF(可移植文件格式)。 它提供了一個高級C#/VB.NET API,用於在網頁伺服器上動態建立PDF,並在現有桌面或Web應用程式中實現儲存為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文件
  • 使用自定義網路登錄憑據、使用者代理、代理、Cookie、HTTP標頭和表單變數載入URL。
  • HTML/PDF表單欄位的程式化完成。
  • 從PDF文件中提取文字和圖形
  • 使用新內容更新PDF頁面。
  • 向PDF新增和自定義標題和頁腳。
  • 合併和分割PDF文件
  • 將ASP.NET網頁表單轉換為可列印的PDF。
  • 將HTML文件/網址轉換為PDF。
  • 列印PDF文件而不使用Adobe Acrobat Reader。

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

  • .NET Core 2.1, 3.0, 3.1, .NET 5, 6, and 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.IronPDFC# 程式庫安裝

  1. PDFium.NET SDK 安裝
  2. 建立PDF文件
  3. 從多個圖像建立PDF
  4. 數位簽名PDF
  5. 價格和授權
  6. 結論

1.IronPDFC# 程式庫安裝

有不同的方法可下載和安裝IronPDF程式庫。 最簡單的方法如下:

  1. 使用Visual Studio
  2. 開發者命令提示符
  3. 直接下載NuGet包
  4. 下載IronPdf.DLL程式庫

1.1. 使用Visual Studio

在您的Visual Studio專案中,從"工具"選單中或在解決方案資源管理器中右鍵按您的專案,選擇"管理NuGet包"。 這兩個選項的截圖如下所示。

IronPDF和PDFium.NET的比較,圖1:使用工具選單存取NuGet包管理器
IronPDF和PDFium.NET的比較,圖2:使用解決方案資源管理器存取NuGet包管理器

打開NuGet包管理器後,瀏覽IronPDF包,並按下方截圖所示安裝。

IronPDF和PDFium.NET的比較,圖3:使用NuGet包管理器安裝IronPDF程式庫

1.2. 使用開發者命令提示符

IronPDF也可以通過開發者命令提示符下載。 按照以下步驟操作:

  • 從工具選單打開開發者命令提示符或包管理器控制台
  • 輸入以下命令:
Install-Package IronPdf
  • 按Enter鍵
  • 這將下載和安裝程式庫

1.3. 直接下載NuGet包

IronPDF還可以通過存取NuGet IronPDF包直接下載。 步驟是:

  • 查找下載包並點擊它。
  • 包將被下載和安裝。

1.4. 下載程式庫來安裝IronPDF

您也可以直接從IronPDF的包頁下載IronPdf.DLL文件

IronPDF和PDFium.NET的比較,圖4:從IronPDF網站下載IronPDF程式庫DLL

通過以下步驟在您的專案中引用IronPDF程式庫:

  • 在解決方案資源管理器中右鍵按解決方案並選擇引用
  • 瀏覽IronPDF.dll程式庫
  • 點擊OK!

全搞定! IronPDF已經下載並安裝。 我們現在將進行安裝PDFium.NET SDK程式庫。

2. PDFium.NET 安裝

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

  • 如同IronPDF一樣在Visual Studio中打開NuGet包。
  • 搜索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

輸出如下:

IronPDF和PDFium.NET的比較,圖6: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:沒有圖像縮放PDF的PDFium.NET輸出

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再分發授權和支持。

所有IronPDF授權均提供30天退款保證,外加一年的軟體支援和升級。 最重要的是,這是一項永久授權(一次性購買)。 提供Lite套件。 IronPDF產品絕對沒有定期收費。 有關可用授權的更詳細資訊,請見IronPDF授權頁面

A Comparison betweenIronPDFand PDFium.NET, Figure 9:IronPDFLicensing

PDFium.NET定價和授權

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

  • 單專案授權設計給單開發者和小團隊從事一個項目。 起價$720。
  • 機構授權設計給開發團隊從事多個項目。
  • 單開發者授權設計給單開發者和自由職業者服務於多個客戶。

您可以存取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稍微便宜,後者有一個價格較低的Lite版本。

IronPDF以有競爭力的價格提供無限授權,而PDFium.NET則有一個適用於無限開發者的組織授權,等級較高。 對於中型團隊,IronPDF的專業授權覆蓋最多10名開發者,其成本約為PDFium.NET同等產品的一半。

在上述例子中,IronPDF比PDFium.NET用更少的程式碼行建立和修改PDF文件——例如,HTML到PDF轉換僅需3行,而PDFium.NET的基於座標的方法大約需要20行,才能得到相若的效果。 IronPDF提供從HTML、URL和ASPX頁面等格式轉換成PDF的多種方法。 PDFium.NET專注於基於圖像和文字的組成,這讓開發者可以更精細地控制頁面佈局,但對於常見轉換任務來說需要更多的手動工作。

您現在可以以上述兩個產品的價格購買Iron Software的所有產品程式庫。 另外,有一個免費試用來測試功能。

請注意PDFium.NET是其相應所有者的註冊商標。 本網站與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設計要求的程式碼行數更少,相比其他程式庫如PDFium.NET,能增強開發者的生產力。

IronPDF支持跨平台的PDF功能嗎?

是的,IronPDF支持多種操作系統和框架,是跨平台PDF功能的多功能選擇。

使用IronPDF比其他PDF程式庫的優勢有哪些?

IronPDF易於使用,擁有強大的功能集如HTML到PDF轉換,以及具競爭力的定價,使其成為許多開發者相比其他PDF程式庫的首選。

Curtis Chau
技術作家

Curtis Chau擁有Carleton大學的電腦科學學士學位,專精於前端開發,擁有Node.js、TypeScript、JavaScript和React的專業知識。Curtis熱衷於建立直觀且美觀的使用者介面,喜愛使用現代框架並建立結構良好、視覺吸引力的手冊。

除了開發,Curtis對物聯網(IoT)有濃厚的興趣,探索創新的方法來整合硬體和軟體。在空閒時間,他喜歡玩遊戲和建立Discord機器人,結合他對技術的熱愛與創造力。

Iron 支援團隊

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