產品比較

IronPDF與Apryse C#之比較

1. 介紹

作為 C# 開發者,處理 PDF 是我們工作中常見的一部分,特別是在構建需要生成、編輯或顯示文件的應用程式時。 這就是為什麼擁有一個好的 PDF 庫是至關重要的。 這些函式庫通過提供內建的功能來完成複雜的任務,例如轉換文件、編輯文字和處理 PDF 中的圖像,從而為我們節省了時間和麻煩。 沒有它們,我們就必須從頭開始撰寫所有程式碼,這不僅耗時,還容易出錯。

在這次比較中,我們正在查看兩個受歡迎的PDF庫:IronPDFApryse C#。 IronPDF 以其強大的功能而聞名,這些功能使在 .NET 環境中處理 PDF 變得輕而易舉,從將 HTML 轉換為 PDF 到高級文件編輯。 另一方面,Apryse C# 提供了一種簡化的 PDF 操作方法,著重於易用性和效率。 我們將深入探討每個庫提供的具體功能,幫助您判斷哪一個最適合您的專案。

2. Apryse C

IronPDF 和 Apryse C# 之間的比較:圖 1 - Apryse C# 網頁

Apryse C# 是一個針對 .NET 應用程式的全面 PDF 程式庫,旨在簡化 C# 環境中的 PDF 操作流程。 它以前被稱為 PDFTron SDK。 其功能和工具的廣泛範圍使其成為開發人員尋求精確和輕鬆處理 PDF 的寶貴資產。

2.1 主要功能

  • 輕鬆整合於 .NET 專案:Apryse C# 提供與 .NET 的無縫整合,包括 ASP.NET Core 和傳統的 .NET Framework 應用程式。 這確保開發人員能夠直接將 PDF 功能集成到他們的項目中,而無需進行廣泛的設置或配置。
  • 文件製作與編輯:開發人員可以使用Apryse C#從頭構建PDF或編輯現有的PDF。 其中包括在應用程序內直接添加文字、圖片和表單,甚至操作 PDF 頁面,例如重新排序、合併或拆分文檔。
  • HTML 轉換為 PDF:使用 Apryse C#,將 HTML 內容轉換為 PDF 格式變得非常簡單。 此功能對於從網頁或 HTML 模板生成發票、報告和其他文檔特別有用。
  • 廣泛支援表單欄位:Apryse C# 提供強大的 PDF 表單欄位支援,允許開發人員程式化地創建、編輯和填寫 PDF 表單。 這是根據使用者輸入或外部資料來源自動生成填寫表單的理想選擇。
  • 文字和內容提取: 這個庫允許從 PDF 文件中提取文字和其他內容。 此功能對於需要分析或處理PDF中信息的應用程式至關重要,例如搜索工具或內容管理系統。
  • 安全和加密:Apryse C# 提供全面的安全功能,包括加密 PDF 文件、設置權限以及管理數位簽名的能力。 這確保敏感文件受到保護並符合合規標準。
  • 高級 PDF 功能:開發人員可以利用諸如註解、書籤和超連結等高級 PDF 功能,以增強其 PDF 文件的互動性和可用性。 這允許創建更動態和使用者友善的 PDF。

3. IronPDF C

IronPDF 與 Apryse C# 的比較:圖 2 - IronPDF 網頁

IronPDF 是為 .NET 開發人員量身打造的一個功能強大且多功能的 PDF 庫。 它簡化了複雜的 PDF 操作過程,允許在 C# 應用程式中直接創建、編輯和轉換 PDF 文件。 IronPDF 可用於不同的程式語言,如 Java、Python 和 C#。 IronPDF 為各種 PDF 處理需求而設計,是開發人員尋求效率和可靠性的首選解決方案。

3.1 主要功能

  • 無縫的 .NET 整合:IronPDF 確保與 .NET 專案輕鬆整合,支持 .NET Framework 和 .NET Core,包括 ASP.NET 專案。 這種相容性有助於將 PDF 功能整合到應用程式中,而無需進行複雜的設置。
  • HTML 到 PDF 轉換:IronPDF 的一個突出功能是其將HTML 轉換為 PDF的能力。 此功能使開發人員能夠將網頁或 HTML 字串轉換為高品質的 PDF 文件,非常適合從 HTML 模板生成報告、收據和其他文檔。
  • 高級 PDF 編輯:使用 IronPDF,開發者可大幅編輯 PDF 文件。 這包括添加文本、圖像和向量圖形,以及修改 PDF 文件中的現有內容。 IronPDF 提供一套全面的編輯工具,以根據具體需求自訂 PDF。
  • PDF 表單處理:IronPDF 提供對PDF 表單的強大支援。 它允許創建和編輯表單欄位,並且可以程式化地填寫表單。 這對於自動化文件工作流程和數據輸入過程特別有用。
  • 內容擷取:該程式庫在從 PDF 文件中提取文字、圖片和甚至元數據方面表現出色。 此功能支持一系列應用程序,從內容分析到數據遷移項目,使開發人員能有效檢索和利用 PDF 內容。
  • 文件安全性:IronPDF 提供全面的安全功能,包括支援密碼保護、加密和 PDF 文件權限管理。 這確保了敏感信息的安全性並控制了文件的訪問。
  • 性能與擴展性:IronPDF考量到性能進行設計,針對速度與擴展性進行了最佳化,適用於處理大量的PDF文件或應對高需求的應用程式,而不會損失性能。
  • 全面的文件和支援:IronPDF 擁有豐富的文件和迅速回應的支援團隊。 這確保開發人員能夠獲得所需的資源和協助,以便在專案中有效地實作和排除 PDF 功能的故障。
  • 與各種 PDF 標準的相容性:IronPDF C# 支援多種 PDF 標準,確保文件與不同檢視程式相容並符合業界規範。 這包括支援PDF/A以供歸檔之用,PDF/UA以加強可存取性,以及更多功能。

4. 建立一個 C# 控制台應用程式

在 Visual Studio 中創建控制台應用程式是一個簡單的過程,它為任何 .NET 開發項目奠定了基礎,包括使用像 IronPDF 或 Apryse C# 之類的庫進行 PDF 操作的項目。 以下是入門指南:

4.1 啟動 Visual Studio

在您的電腦上打開 Visual Studio。 如果你還沒安裝 Visual Studio,請從 Microsoft 官方網站下載並安裝,選擇適合你需求的版本。

4.2 建立新專案

一旦打開 Visual Studio,從初始面板中選擇「建立新專案」選項。

IronPDF 與 Apryse C# 的比較:圖 3 - 創建新的 VS 專案

4.3 選擇專案類型

在「建立新專案」視窗中,您將看到各種專案範本。 在搜尋框中輸入「Console」或從列表中找到「Console Application」模板。請確保選擇專為C#設計的模板,而非其他語言。

IronPDF 與 Apryse C# 的比較:圖 4 - 選擇主控台應用程式範本

4.4 配置您的專案

選擇「控制台應用程序」模板後,點擊「下一步」按鈕。 您將被提示配置新的專案:

  • 專案名稱: 輸入您的專案名稱。
  • 位置:選擇您想要在電腦上儲存專案的位置。

    • 解決方案名稱:預設情況下,這與您的項目名稱相符,但您可以自行更改。

    IronPDF與Apryse C#的比較:圖5 - 配置項目詳情

    • 框架:選擇您想要使用的 .NET 版本。 對於大多數用途,建議使用最新版本,除非您有特定需求。

    IronPDF與Apryse C#的比較:圖6 - 選擇適當的.NET框架

4.5 建立項目

在配置專案設定後,點擊「建立」按鈕。 Visual Studio 將建立一個新的控制台應用程式專案,並預設提供一個 Program.cs 檔案。

4.6 探索專案結構

花一點時間在解決方案資源管理器窗格中瀏覽生成的項目結構。 您將主要在 Program.cs 文件中進行操作,這是用於主控台應用程式,您將在此撰寫您的 C# 代碼。

安裝IronPDF庫

將 IronPDF 庫整合到您的 .NET 專案中,讓您可以利用其全面的 PDF 處理功能。 有多種安裝IronPDF的方法,確保根據您的首選工作流程或開發環境設置提供靈活性。

5.1 使用 NuGet 套件管理器

Visual Studio 中的 NuGet 套件管理器提供了一個用戶友好的界面,用於管理程式庫和依賴項。

  1. 在 Visual Studio 中打開您的專案。

  2. 導航到解決方案總管,右鍵點擊您的專案,選擇「管理 NuGet 套件」。

  3. 點擊「瀏覽」標籤並搜尋「IronPdf」。

    1. 在搜尋結果中找到 IronPDF,選擇它,然後點擊“安裝”。Visual Studio 會處理其餘的步驟,將 IronPDF 添加到您的項目中。

    IronPDF 與 Apryse C# 的比較:圖7 - 透過 NuGet 套件管理器安裝 IronPDF

5.2 使用 Visual Studio 命令行

對於那些偏好使用命令列的人,Visual Studio 中的套件管理器主控台提供了一種直接安裝套件的方法。

  1. 打開 Visual Studio 並進入您的專案。

  2. 導航至工具 > NuGet 套件管理員 > 套件管理員主控台.

    1. 在控制台中,輸入以下命令然後按 Enter:
Install-Package IronPdf
Install-Package IronPdf
SHELL

此命令將下載並安裝最新版本的IronPDF到您的專案中。

5.3 從 NuGet 網頁直接下載

如果您希望在將套件整合到專案中之前手動下載它,可以從 NuGet 網站下載。

  1. 請造訪NuGet網站,並搜尋「IronPdf」。

    1. IronPdf 套件頁面上,找到「Download Package」鏈接並點擊以下載 .nupkg 文件。

    IronPDF 與 Apryse C# 的比較:圖 8 - 通過 NuGet 網頁直接安裝 IronPDF

  2. 下載後,您可以手動將套件添加到您的項目中。 在 Visual Studio 中,導航到方案總管,右鍵點擊你的專案,然後選擇「新增 > 參考」。導航到已下載的 .nupkg 檔案的位置,選擇它並將其添加到你的專案中。

    這些方法每一種都能成功地將 IronPDF 整合到您的 .NET 專案中,讓您開始使用其強大的 PDF 處理功能。

6. 安裝 Apryse C

要將 Apryse C# 整合到您的 C# 項目中,您可以根據您使用 .NET Framework 或 .NET Core 的情況,以及您的開發環境偏好,有幾種選擇。 以下是根據Apryse文件和設置指南的概括步驟:

6.1 適用於 .NET Framework

  1. 下載 Apryse SDK for Windows:您需要訪問 Apryse SDK for Windows 頁面 以下載適用於 .NET Framework 應用程式的 SDK。

    IronPDF 與 Apryse C# 的比較:圖 9 - 在 Apryse 網頁下載 Apryse SDK

  1. 提取 SDK:下載後,將 SDK 提取到系統上已知的位置。

  2. 獲取 Apryse 試用金鑰:註冊 Apryse 平台以獲得試用金鑰,您將使用它來啟用 SDK 的試用功能。

  3. 設定專案:在 Visual Studio 中,建立一個新的 .NET Framework 主控台應用程式。 然後,將提取的 SDK 中的 Lib 資料夾新增到您的專案目錄中。

  4. 添加引用:在專案中右鍵點擊引用,選擇“添加引用”,並導航到您已複製 PDFNetLoader.dll 和適合您架構(x86 或 x64)的 PDFNet.dllLib 資料夾。 確保將PDFNet.dll的「本地複製」屬性設置為 false。

  5. 配置 App.config:確保您的 App.config 檔案已啟用 loadFromRemoteSources 設定為 true。

    SDK 中有範例資料夾。 您可以直接開啟和運行這些範例解決方案。

7 個 IronPDF 進階功能

7.1 HTML 轉換為 PDF

IronPDF 在將 HTML 轉換為 PDF 文件方面表現出色。 此功能對於需要將報告、發票或網頁快照生成為PDF文件的網絡應用程序而言至關重要。 該庫準確地渲染HTML、CSS和JavaScript,在生成的PDF中捕捉網頁內容的佈局和樣式。

7.1.1 HTML 字串轉 PDF

將 HTML 字串直接轉換為 PDF 允許從應用程式中生成的 HTML 內容或儲存在變數中的內容動態地創建 PDF。 這對於根據使用者輸入或應用程式資料生成自訂報告、收據或文件特別有用。

using IronPdf;
// Disable local disk access or cross-origin requests
Installation.EnableWebSecurity = true;
IronPdf.License.LicenseKey = "License-Key goes here";
// Instantiate Renderer
var renderer = new ChromePdfRenderer();
// Create a different HTML string
string htmlContent = @"
<!DOCTYPE html>
<html lang='en'>
<head>
    <meta charset='UTF-8'>
    <meta name='viewport' content='width=device-width, initial-scale=1.0'>
    <title>My PDF</title>
    <style>
        body {
            font-family: Arial, sans-serif;
        }
        h1 {
            color: #333;
            text-align: center;
        }
        p {
            color: #666;
            text-align: justify;
        }
    </style>
</head>
<body>
    <h1>Welcome to My PDF</h1>
    <p>This is a sample paragraph demonstrating how to create a PDF from HTML using IronPdf in C#.</p>
    <p>You can add more content here as needed.</p>
</body>
</html>";
// Create a PDF from the HTML string using C#
var pdf = renderer.RenderHtmlAsPdf(htmlContent);
// Export to a file or Stream
pdf.SaveAs("output.pdf");
using IronPdf;
// Disable local disk access or cross-origin requests
Installation.EnableWebSecurity = true;
IronPdf.License.LicenseKey = "License-Key goes here";
// Instantiate Renderer
var renderer = new ChromePdfRenderer();
// Create a different HTML string
string htmlContent = @"
<!DOCTYPE html>
<html lang='en'>
<head>
    <meta charset='UTF-8'>
    <meta name='viewport' content='width=device-width, initial-scale=1.0'>
    <title>My PDF</title>
    <style>
        body {
            font-family: Arial, sans-serif;
        }
        h1 {
            color: #333;
            text-align: center;
        }
        p {
            color: #666;
            text-align: justify;
        }
    </style>
</head>
<body>
    <h1>Welcome to My PDF</h1>
    <p>This is a sample paragraph demonstrating how to create a PDF from HTML using IronPdf in C#.</p>
    <p>You can add more content here as needed.</p>
</body>
</html>";
// Create a PDF from the HTML string using C#
var pdf = renderer.RenderHtmlAsPdf(htmlContent);
// Export to a file or Stream
pdf.SaveAs("output.pdf");
Imports IronPdf
' Disable local disk access or cross-origin requests
Installation.EnableWebSecurity = True
IronPdf.License.LicenseKey = "License-Key goes here"
' Instantiate Renderer
Dim renderer = New ChromePdfRenderer()
' Create a different HTML string
Dim htmlContent As String = "
<!DOCTYPE html>
<html lang='en'>
<head>
    <meta charset='UTF-8'>
    <meta name='viewport' content='width=device-width, initial-scale=1.0'>
    <title>My PDF</title>
    <style>
        body {
            font-family: Arial, sans-serif;
        }
        h1 {
            color: #333;
            text-align: center;
        }
        p {
            color: #666;
            text-align: justify;
        }
    </style>
</head>
<body>
    <h1>Welcome to My PDF</h1>
    <p>This is a sample paragraph demonstrating how to create a PDF from HTML using IronPdf in C#.</p>
    <p>You can add more content here as needed.</p>
</body>
</html>"
' Create a PDF from the HTML string using C#
Dim pdf = renderer.RenderHtmlAsPdf(htmlContent)
' Export to a file or Stream
pdf.SaveAs("output.pdf")
$vbLabelText   $csharpLabel

IronPDF與Apryse C#的比較:圖10 - 從HTML字串輸出的PDF

HTML 文件轉 PDF

當您在磁碟上儲存了一個HTML檔案時,IronPDF可以將此檔案轉換成PDF文件。 此方法非常適合將項目或伺服器上保存為文件的現有HTML文檔、模板或報告進行轉換。

using IronPdf;
IronPdf.License.LicenseKey = "License-Key goes here";
// Disable local disk access or cross-origin requests
Installation.EnableWebSecurity = true;
// Instantiate Renderer
var renderer = new ChromePdfRenderer();
// Create a PDF from the HTML string using C#
var pdf = renderer.RenderHtmlFileAsPdf("invoice.html");
// Export to a file or Stream
pdf.SaveAs("file.pdf");
using IronPdf;
IronPdf.License.LicenseKey = "License-Key goes here";
// Disable local disk access or cross-origin requests
Installation.EnableWebSecurity = true;
// Instantiate Renderer
var renderer = new ChromePdfRenderer();
// Create a PDF from the HTML string using C#
var pdf = renderer.RenderHtmlFileAsPdf("invoice.html");
// Export to a file or Stream
pdf.SaveAs("file.pdf");
Imports IronPdf
IronPdf.License.LicenseKey = "License-Key goes here"
' Disable local disk access or cross-origin requests
Installation.EnableWebSecurity = True
' Instantiate Renderer
Dim renderer = New ChromePdfRenderer()
' Create a PDF from the HTML string using C#
Dim pdf = renderer.RenderHtmlFileAsPdf("invoice.html")
' Export to a file or Stream
pdf.SaveAs("file.pdf")
$vbLabelText   $csharpLabel

IronPDF 與 Apryse C# 的比較:圖 11 - 從 HTML 文件輸出的 PDF

7.1.3 URL 轉換為 PDF

IronPDF 可以透過提供 URL 將實時網頁轉換為 PDF 文件。 此功能非常適合用於捕獲網頁的當前狀態,包括複雜的佈局、CSS和由JavaScript生成的內容。

using IronPdf;
IronPdf.License.LicenseKey = "License-Key goes here";
// Disable local disk access or cross-origin requests
Installation.EnableWebSecurity = true;
// Instantiate Renderer
var renderer = new ChromePdfRenderer();
// Create a PDF from the HTML string using C#
var pdf = renderer.RenderUrlAsPdf("https://dotnet.microsoft.com/en-us/download/dotnet-framework");
// Export to a file or Stream
pdf.SaveAs("url.pdf");
using IronPdf;
IronPdf.License.LicenseKey = "License-Key goes here";
// Disable local disk access or cross-origin requests
Installation.EnableWebSecurity = true;
// Instantiate Renderer
var renderer = new ChromePdfRenderer();
// Create a PDF from the HTML string using C#
var pdf = renderer.RenderUrlAsPdf("https://dotnet.microsoft.com/en-us/download/dotnet-framework");
// Export to a file or Stream
pdf.SaveAs("url.pdf");
Imports IronPdf
IronPdf.License.LicenseKey = "License-Key goes here"
' Disable local disk access or cross-origin requests
Installation.EnableWebSecurity = True
' Instantiate Renderer
Dim renderer = New ChromePdfRenderer()
' Create a PDF from the HTML string using C#
Dim pdf = renderer.RenderUrlAsPdf("https://dotnet.microsoft.com/en-us/download/dotnet-framework")
' Export to a file or Stream
pdf.SaveAs("url.pdf")
$vbLabelText   $csharpLabel

IronPDF & Apryse C# 比較:圖12 - 從URL輸出的PDF

7.2 PDF 合併與分割

使用 IronPDF,將多個 PDF 文檔合併為一個文件或將 PDF 分割成幾個較小的文檔都很簡單。 此功能對於需要組織和結構化 PDF 內容的文件管理系統至關重要。

using IronPdf;
IronPdf.License.LicenseKey = "License-Key goes here";
// Disable local disk access or cross-origin requests
Installation.EnableWebSecurity = true;
var html_a = @"
    <h1>PDF A</h1>
    <p>This is the content of PDF A.</p>
    <p>This is the first page of PDF A.</p>
    <div style='page-break-after: always;'></div>
    <p>This is the second page of PDF A.</p>";
var html_b = @"
    <h1>PDF B</h1>
    <p>This is the content of PDF B.</p>
    <p>This is the first page of PDF B.</p>
    <div style='page-break-after: always;'></div>
    <p>This is the second page of PDF B.</p>";
var renderer = new ChromePdfRenderer();
var pdfdoc_a = renderer.RenderHtmlAsPdf(html_a);
var pdfdoc_b = renderer.RenderHtmlAsPdf(html_b);
var merged = PdfDocument.Merge(pdfdoc_a, pdfdoc_b);
merged.SaveAs("Merged.pdf");
using IronPdf;
IronPdf.License.LicenseKey = "License-Key goes here";
// Disable local disk access or cross-origin requests
Installation.EnableWebSecurity = true;
var html_a = @"
    <h1>PDF A</h1>
    <p>This is the content of PDF A.</p>
    <p>This is the first page of PDF A.</p>
    <div style='page-break-after: always;'></div>
    <p>This is the second page of PDF A.</p>";
var html_b = @"
    <h1>PDF B</h1>
    <p>This is the content of PDF B.</p>
    <p>This is the first page of PDF B.</p>
    <div style='page-break-after: always;'></div>
    <p>This is the second page of PDF B.</p>";
var renderer = new ChromePdfRenderer();
var pdfdoc_a = renderer.RenderHtmlAsPdf(html_a);
var pdfdoc_b = renderer.RenderHtmlAsPdf(html_b);
var merged = PdfDocument.Merge(pdfdoc_a, pdfdoc_b);
merged.SaveAs("Merged.pdf");
Imports IronPdf
IronPdf.License.LicenseKey = "License-Key goes here"
' Disable local disk access or cross-origin requests
Installation.EnableWebSecurity = True
Dim html_a = "
    <h1>PDF A</h1>
    <p>This is the content of PDF A.</p>
    <p>This is the first page of PDF A.</p>
    <div style='page-break-after: always;'></div>
    <p>This is the second page of PDF A.</p>"
Dim html_b = "
    <h1>PDF B</h1>
    <p>This is the content of PDF B.</p>
    <p>This is the first page of PDF B.</p>
    <div style='page-break-after: always;'></div>
    <p>This is the second page of PDF B.</p>"
Dim renderer = New ChromePdfRenderer()
Dim pdfdoc_a = renderer.RenderHtmlAsPdf(html_a)
Dim pdfdoc_b = renderer.RenderHtmlAsPdf(html_b)
Dim merged = PdfDocument.Merge(pdfdoc_a, pdfdoc_b)
merged.SaveAs("Merged.pdf")
$vbLabelText   $csharpLabel

7.3 添加浮水印

IronPDF 允許您在 PDF 頁面上添加浮水印,這對於品牌化或將文件標記為機密非常有用。 此功能支持文字和圖像浮水印,提供套用和顯示浮水印的靈活性。

using IronPdf;
IronPdf.License.LicenseKey = "License-Key goes here";
// Disable local disk access or cross-origin requests
Installation.EnableWebSecurity = true;
// Stamps a Watermark onto a new or existing PDF
var renderer = new ChromePdfRenderer();
var pdf = renderer.RenderUrlAsPdf("https://www.nuget.org/packages/IronPdf");
pdf.ApplyWatermark("<h2 style='color:red'>SAMPLE</h2>", 30, IronPdf.Editing.VerticalAlignment.Middle, IronPdf.Editing.HorizontalAlignment.Center);
pdf.SaveAs("Watermarked.pdf");
using IronPdf;
IronPdf.License.LicenseKey = "License-Key goes here";
// Disable local disk access or cross-origin requests
Installation.EnableWebSecurity = true;
// Stamps a Watermark onto a new or existing PDF
var renderer = new ChromePdfRenderer();
var pdf = renderer.RenderUrlAsPdf("https://www.nuget.org/packages/IronPdf");
pdf.ApplyWatermark("<h2 style='color:red'>SAMPLE</h2>", 30, IronPdf.Editing.VerticalAlignment.Middle, IronPdf.Editing.HorizontalAlignment.Center);
pdf.SaveAs("Watermarked.pdf");
Imports IronPdf
IronPdf.License.LicenseKey = "License-Key goes here"
' Disable local disk access or cross-origin requests
Installation.EnableWebSecurity = True
' Stamps a Watermark onto a new or existing PDF
Dim renderer = New ChromePdfRenderer()
Dim pdf = renderer.RenderUrlAsPdf("https://www.nuget.org/packages/IronPdf")
pdf.ApplyWatermark("<h2 style='color:red'>SAMPLE</h2>", 30, IronPdf.Editing.VerticalAlignment.Middle, IronPdf.Editing.HorizontalAlignment.Center)
pdf.SaveAs("Watermarked.pdf")
$vbLabelText   $csharpLabel

IronPDF 與 Apryse C# 的比較:圖13 - 輸出的 PDF 含「SAMPLE」浮水印

7.4 PDF 表單

IronPDF 支援處理互動式 PDF 表單。 它能以程式的方式創建、填寫和提交 PDF 表單。 這對於需要自動化表單處理或將表單數據收集整合到工作流程中的應用程式特別有用。

using IronPdf;
IronPdf.License.LicenseKey = "License-Key goes here";
// Disable local disk access or cross-origin requests
Installation.EnableWebSecurity = true;
const string differentFormHtml = @"
    <html>
        <body>
            <h2>Employee Information Form</h2>
            <form>
                First name: <br> 
                Last name: <br> 
                <br>
                <p>Please select your department:</p>
                <select name='department'>
                    <option value='HR'>HR</option>
                    <option value='Finance'>Finance</option>
                    <option value='IT'>IT</option>
                    <option value='Marketing'>Marketing</option>
                </select>
                <br>
                <br>
                <p>Please select your employment status:</p>
                <label for='fulltime'>Full-time</label> <br>
                <label for='parttime'>Part-time</label> <br>
                <br>
                <p>Please select your skills:</p>
                <label for='skill1'> Programming</label><br>
                <label for='skill2'> Design</label><br>
                <label for='skill3'> Marketing</label><br>
            </form>
        </body>
    </html>";
// Instantiate Renderer
var renderer = new ChromePdfRenderer();
renderer.RenderingOptions.CreatePdfFormsFromHtml = true;
renderer.RenderHtmlAsPdf(differentFormHtml).SaveAs("EmployeeInfoForm.pdf");
using IronPdf;
IronPdf.License.LicenseKey = "License-Key goes here";
// Disable local disk access or cross-origin requests
Installation.EnableWebSecurity = true;
const string differentFormHtml = @"
    <html>
        <body>
            <h2>Employee Information Form</h2>
            <form>
                First name: <br> 
                Last name: <br> 
                <br>
                <p>Please select your department:</p>
                <select name='department'>
                    <option value='HR'>HR</option>
                    <option value='Finance'>Finance</option>
                    <option value='IT'>IT</option>
                    <option value='Marketing'>Marketing</option>
                </select>
                <br>
                <br>
                <p>Please select your employment status:</p>
                <label for='fulltime'>Full-time</label> <br>
                <label for='parttime'>Part-time</label> <br>
                <br>
                <p>Please select your skills:</p>
                <label for='skill1'> Programming</label><br>
                <label for='skill2'> Design</label><br>
                <label for='skill3'> Marketing</label><br>
            </form>
        </body>
    </html>";
// Instantiate Renderer
var renderer = new ChromePdfRenderer();
renderer.RenderingOptions.CreatePdfFormsFromHtml = true;
renderer.RenderHtmlAsPdf(differentFormHtml).SaveAs("EmployeeInfoForm.pdf");
Imports IronPdf
IronPdf.License.LicenseKey = "License-Key goes here"
' Disable local disk access or cross-origin requests
Installation.EnableWebSecurity = True
Const differentFormHtml As String = "
    <html>
        <body>
            <h2>Employee Information Form</h2>
            <form>
                First name: <br> 
                Last name: <br> 
                <br>
                <p>Please select your department:</p>
                <select name='department'>
                    <option value='HR'>HR</option>
                    <option value='Finance'>Finance</option>
                    <option value='IT'>IT</option>
                    <option value='Marketing'>Marketing</option>
                </select>
                <br>
                <br>
                <p>Please select your employment status:</p>
                <label for='fulltime'>Full-time</label> <br>
                <label for='parttime'>Part-time</label> <br>
                <br>
                <p>Please select your skills:</p>
                <label for='skill1'> Programming</label><br>
                <label for='skill2'> Design</label><br>
                <label for='skill3'> Marketing</label><br>
            </form>
        </body>
    </html>"
' Instantiate Renderer
Dim renderer = New ChromePdfRenderer()
renderer.RenderingOptions.CreatePdfFormsFromHtml = True
renderer.RenderHtmlAsPdf(differentFormHtml).SaveAs("EmployeeInfoForm.pdf")
$vbLabelText   $csharpLabel

IronPDF 和 Apryse C# 的比較:圖 14 - 輸出的 PDF 具互動表單

7.5 安全與加密

IronPDF 提供多種功能來保護 PDF 文件,包括加密 PDF 文件、設定權限和添加電子簽名的能力。 這確保了 PDF 文件中的敏感資訊受到保護,並且保持文件完整性。

using IronPdf;
IronPdf.License.LicenseKey = "License-Key" goes here;
// Disable local disk access or cross-origin requests
Installation.EnableWebSecurity = true;
var pdf = PdfDocument.FromFile("invoice.pdf");
// Change or set the document encryption password
pdf.SecuritySettings.OwnerPassword = "top-secret"; // password to edit the pdf
pdf.SecuritySettings.UserPassword = "sharable"; // password to open the pdf
pdf.SaveAs("secured.pdf");
using IronPdf;
IronPdf.License.LicenseKey = "License-Key" goes here;
// Disable local disk access or cross-origin requests
Installation.EnableWebSecurity = true;
var pdf = PdfDocument.FromFile("invoice.pdf");
// Change or set the document encryption password
pdf.SecuritySettings.OwnerPassword = "top-secret"; // password to edit the pdf
pdf.SecuritySettings.UserPassword = "sharable"; // password to open the pdf
pdf.SaveAs("secured.pdf");
Imports IronPdf
IronPdf.License.LicenseKey = "License-Key" goes here
' Disable local disk access or cross-origin requests
Installation.EnableWebSecurity = True
Dim pdf = PdfDocument.FromFile("invoice.pdf")
' Change or set the document encryption password
pdf.SecuritySettings.OwnerPassword = "top-secret" ' password to edit the pdf
pdf.SecuritySettings.UserPassword = "sharable" ' password to open the pdf
pdf.SaveAs("secured.pdf")
$vbLabelText   $csharpLabel

IronPDF 與 Apryse C# 的比較:圖 15 - 來自受密碼保護 PDF 的彈出窗口

7.6 高級 PDF 編輯

IronPDF 不僅僅是基本的 PDF 編輯,還提供進階的編輯功能。 這包括添加頁眉和頁腳、自定義頁面佈局和設計,以及嵌入圖像和字體。 這些功能允許根據特定應用程式需求動態生成和自訂 PDF。

using IronPdf;
IronPdf.License.LicenseKey = "License-Key goes here";
// Disable local disk access or cross-origin requests
Installation.EnableWebSecurity = true;
// Instantiate Renderer
var renderer = new IronPdf.ChromePdfRenderer();
var multi_page_html = @"
    <p> This is 1st Page</p>
    <div style = 'page-break-after: always;' ></div>
    <p> This is 2nd Page</p>
    <div style = 'page-break-after: always;' ></div>
    <p> This is 3rd Page</p>
    <div style = 'page-break-after: always;' ></div>
    <p> This is 4th Page</p>
    <div style = 'page-break-after: always;' ></div>
    <p> This is 5th Page</p>
    <div style = 'page-break-after: always;' ></div>
    <p> This is 6th Page</p>
    <div style = 'page-break-after: always;' ></div>
    <p> This is 7th Page</p>";
// Create a PDF or Load an existing PDF using IronPdf.PdfDocument.Load()
var pdfdoc = renderer.RenderHtmlAsPdf(multi_page_html);
// Create a Header for the first page only
var firstPageHeader = new HtmlHeaderFooter();
firstPageHeader.HtmlFragment = "This is the First Page Header";
pdfdoc.AddHtmlHeaders(firstPageHeader, 1);
pdfdoc.SaveAs("PagesWithHeaders.pdf");
using IronPdf;
IronPdf.License.LicenseKey = "License-Key goes here";
// Disable local disk access or cross-origin requests
Installation.EnableWebSecurity = true;
// Instantiate Renderer
var renderer = new IronPdf.ChromePdfRenderer();
var multi_page_html = @"
    <p> This is 1st Page</p>
    <div style = 'page-break-after: always;' ></div>
    <p> This is 2nd Page</p>
    <div style = 'page-break-after: always;' ></div>
    <p> This is 3rd Page</p>
    <div style = 'page-break-after: always;' ></div>
    <p> This is 4th Page</p>
    <div style = 'page-break-after: always;' ></div>
    <p> This is 5th Page</p>
    <div style = 'page-break-after: always;' ></div>
    <p> This is 6th Page</p>
    <div style = 'page-break-after: always;' ></div>
    <p> This is 7th Page</p>";
// Create a PDF or Load an existing PDF using IronPdf.PdfDocument.Load()
var pdfdoc = renderer.RenderHtmlAsPdf(multi_page_html);
// Create a Header for the first page only
var firstPageHeader = new HtmlHeaderFooter();
firstPageHeader.HtmlFragment = "This is the First Page Header";
pdfdoc.AddHtmlHeaders(firstPageHeader, 1);
pdfdoc.SaveAs("PagesWithHeaders.pdf");
Imports IronPdf
IronPdf.License.LicenseKey = "License-Key goes here"
' Disable local disk access or cross-origin requests
Installation.EnableWebSecurity = True
' Instantiate Renderer
Dim renderer = New IronPdf.ChromePdfRenderer()
Dim multi_page_html = "
    <p> This is 1st Page</p>
    <div style = 'page-break-after: always;' ></div>
    <p> This is 2nd Page</p>
    <div style = 'page-break-after: always;' ></div>
    <p> This is 3rd Page</p>
    <div style = 'page-break-after: always;' ></div>
    <p> This is 4th Page</p>
    <div style = 'page-break-after: always;' ></div>
    <p> This is 5th Page</p>
    <div style = 'page-break-after: always;' ></div>
    <p> This is 6th Page</p>
    <div style = 'page-break-after: always;' ></div>
    <p> This is 7th Page</p>"
' Create a PDF or Load an existing PDF using IronPdf.PdfDocument.Load()
Dim pdfdoc = renderer.RenderHtmlAsPdf(multi_page_html)
' Create a Header for the first page only
Dim firstPageHeader = New HtmlHeaderFooter()
firstPageHeader.HtmlFragment = "This is the First Page Header"
pdfdoc.AddHtmlHeaders(firstPageHeader, 1)
pdfdoc.SaveAs("PagesWithHeaders.pdf")
$vbLabelText   $csharpLabel

IronPDF與Apryse C#之間的比較:圖16 - 輸出的多頁PDF

8 Apryse C# 高級功能

8.1 PDF 註釋和標記

Apryse C#使開發者能夠以程式方式向 PDF 文件添加註釋和標記。 這包括文字註釋、重點標示、下劃線和形狀,這些對於文件審核過程或為PDF添加補充信息是必不可少的。

using pdftron;
using pdftron.PDF;
using pdftron.SDF;
class Program
{
    static void Main()
    {
        PDFNet.Initialize("License");
        using (PDFDoc doc = new PDFDoc("input.pdf"))
        {
            Page page = doc.GetPage(1);
           Text txt = Text.Create(doc, new Rect(10, 20, 30, 40));
        txt.SetIcon("UserIcon");
        txt.SetContents("It's an annotation!"); 
        page.AnnotPushBack(txt);
            page.AnnotPushBack(annot);
            doc.Save("output.pdf", SDFDoc.SaveOptions.e_linearized);
        }
    }
}
using pdftron;
using pdftron.PDF;
using pdftron.SDF;
class Program
{
    static void Main()
    {
        PDFNet.Initialize("License");
        using (PDFDoc doc = new PDFDoc("input.pdf"))
        {
            Page page = doc.GetPage(1);
           Text txt = Text.Create(doc, new Rect(10, 20, 30, 40));
        txt.SetIcon("UserIcon");
        txt.SetContents("It's an annotation!"); 
        page.AnnotPushBack(txt);
            page.AnnotPushBack(annot);
            doc.Save("output.pdf", SDFDoc.SaveOptions.e_linearized);
        }
    }
}
Imports pdftron
Imports pdftron.PDF
Imports pdftron.SDF
Friend Class Program
	Shared Sub Main()
		PDFNet.Initialize("License")
		Using doc As New PDFDoc("input.pdf")
			Dim page As Page = doc.GetPage(1)
		   Dim txt As Text = Text.Create(doc, New Rect(10, 20, 30, 40))
		txt.SetIcon("UserIcon")
		txt.SetContents("It's an annotation!")
		page.AnnotPushBack(txt)
			page.AnnotPushBack(annot)
			doc.Save("output.pdf", SDFDoc.SaveOptions.e_linearized)
		End Using
	End Sub
End Class
$vbLabelText   $csharpLabel

IronPDF 與 Apryse C# 的比較:圖 17 - 帶有圖標和註釋的輸出 PDF

8.2 文件轉換

使用 Apryse C#,開發人員可以將各種文件格式轉換為 PDF,包括 Office 文件、圖像和 HTML。 這項功能對於需要統一文件格式進行存檔、分享或展示的應用程式至關重要。

using pdftron;
using pdftron.PDF;
class Program
{
    static void Main()
    {
        PDFNet.Initialize();
        PDFDoc pdfdoc = new PDFDoc();
        Convert.ToPdf(pdfdoc, "input.docx");
        pdfdoc.Save("output.pdf", SDFDoc.SaveOptions.e_linearized);
    }
}
using pdftron;
using pdftron.PDF;
class Program
{
    static void Main()
    {
        PDFNet.Initialize();
        PDFDoc pdfdoc = new PDFDoc();
        Convert.ToPdf(pdfdoc, "input.docx");
        pdfdoc.Save("output.pdf", SDFDoc.SaveOptions.e_linearized);
    }
}
Imports pdftron
Imports pdftron.PDF
Friend Class Program
	Shared Sub Main()
		PDFNet.Initialize()
		Dim pdfdoc As New PDFDoc()
		Convert.ToPdf(pdfdoc, "input.docx")
		pdfdoc.Save("output.pdf", SDFDoc.SaveOptions.e_linearized)
	End Sub
End Class
$vbLabelText   $csharpLabel

8.3 內容提取與分析

Apryse C# 擅長從 PDF 文件中提取文字、圖像及其他內容。 此功能對於內容分析、資料提取和信息檢索應用至關重要,使得 PDF 內容的處理由於各種目的成為可能。

using pdftron;
using pdftron.PDF;
using pdftron.SDF;
class Program
{
    static void Main()
    {
        PDFNet.Initialize();
        using (PDFDoc doc = new PDFDoc("input.pdf"))
        {
            PageIterator itr = doc.GetPageIterator();
            for (; itr.HasNext(); itr.Next())
            {
                Page page = itr.Current();
                TextExtractor txt = new TextExtractor();
                txt.Begin(page);
                Console.WriteLine(txt.GetAsText());
            }
        }
    }
}
using pdftron;
using pdftron.PDF;
using pdftron.SDF;
class Program
{
    static void Main()
    {
        PDFNet.Initialize();
        using (PDFDoc doc = new PDFDoc("input.pdf"))
        {
            PageIterator itr = doc.GetPageIterator();
            for (; itr.HasNext(); itr.Next())
            {
                Page page = itr.Current();
                TextExtractor txt = new TextExtractor();
                txt.Begin(page);
                Console.WriteLine(txt.GetAsText());
            }
        }
    }
}
Imports pdftron
Imports pdftron.PDF
Imports pdftron.SDF
Friend Class Program
	Shared Sub Main()
		PDFNet.Initialize()
		Using doc As New PDFDoc("input.pdf")
			Dim itr As PageIterator = doc.GetPageIterator()
			Do While itr.HasNext()
				Dim page As Page = itr.Current()
				Dim txt As New TextExtractor()
				txt.Begin(page)
				Console.WriteLine(txt.GetAsText())
				itr.Next()
			Loop
		End Using
	End Sub
End Class
$vbLabelText   $csharpLabel

IronPDF 與 Apryse C# 的比較:圖 18 - 從 PDF 提取的文本的控制台輸出

8.4 安全與加密

Apryse C# 提供全面的工具來確保 PDF 文件的安全性。 開發人員可以應用密碼保護、加密文件及管理用戶權限,確保敏感資訊受到保護。

using pdftron;
using pdftron.SDF;
using pdftron.PDF;
class Program
{
    static void Main()
    {
        PDFNet.Initialize();
        using (PDFDoc doc = new PDFDoc("input.pdf"))
        {
            doc.InitSecurityHandler();
            SecurityHandler newHandler = new SecurityHandler();
            newHandler.ChangeUserPassword("new_password");
            newHandler.SetPermission(SecurityHandler.Permission.e_print, true);
            doc.SetSecurityHandler(newHandler);
            doc.Save("output.pdf", SDFDoc.SaveOptions.e_linearized);
        }
    }
}
using pdftron;
using pdftron.SDF;
using pdftron.PDF;
class Program
{
    static void Main()
    {
        PDFNet.Initialize();
        using (PDFDoc doc = new PDFDoc("input.pdf"))
        {
            doc.InitSecurityHandler();
            SecurityHandler newHandler = new SecurityHandler();
            newHandler.ChangeUserPassword("new_password");
            newHandler.SetPermission(SecurityHandler.Permission.e_print, true);
            doc.SetSecurityHandler(newHandler);
            doc.Save("output.pdf", SDFDoc.SaveOptions.e_linearized);
        }
    }
}
Imports pdftron
Imports pdftron.SDF
Imports pdftron.PDF
Friend Class Program
	Shared Sub Main()
		PDFNet.Initialize()
		Using doc As New PDFDoc("input.pdf")
			doc.InitSecurityHandler()
			Dim newHandler As New SecurityHandler()
			newHandler.ChangeUserPassword("new_password")
			newHandler.SetPermission(SecurityHandler.Permission.e_print, True)
			doc.SetSecurityHandler(newHandler)
			doc.Save("output.pdf", SDFDoc.SaveOptions.e_linearized)
		End Using
	End Sub
End Class
$vbLabelText   $csharpLabel

8.5 紅色除去

Apryse C# 也支援從 PDF 文件中編輯敏感資訊,這是符合合規性和隱私考量的重要功能。 這允許開發人員永久移除或遮掩 PDF 中的文字和圖片。

using pdftron;
using pdftron.PDF;
using pdftron.SDF;
class Program
{
    static void Main()
    {
        PDFNet.Initialize();
        using (PDFDoc doc = new PDFDoc("input.pdf"))
        {
            Redactor.Redaction [] redactions = {
                new Redactor.Redaction(1, new Rect(100, 100, 200, 200), false, "redacted"),
            };
            Redactor.Redact(doc, redactions);
            doc.Save("output.pdf", SDFDoc.SaveOptions.e_linearized);
        }
    }
}
using pdftron;
using pdftron.PDF;
using pdftron.SDF;
class Program
{
    static void Main()
    {
        PDFNet.Initialize();
        using (PDFDoc doc = new PDFDoc("input.pdf"))
        {
            Redactor.Redaction [] redactions = {
                new Redactor.Redaction(1, new Rect(100, 100, 200, 200), false, "redacted"),
            };
            Redactor.Redact(doc, redactions);
            doc.Save("output.pdf", SDFDoc.SaveOptions.e_linearized);
        }
    }
}
Imports pdftron
Imports pdftron.PDF
Imports pdftron.SDF
Friend Class Program
	Shared Sub Main()
		PDFNet.Initialize()
		Using doc As New PDFDoc("input.pdf")
			Dim redactions() As Redactor.Redaction = { New Redactor.Redaction(1, New Rect(100, 100, 200, 200), False, "redacted")}
			Redactor.Redact(doc, redactions)
			doc.Save("output.pdf", SDFDoc.SaveOptions.e_linearized)
		End Using
	End Sub
End Class
$vbLabelText   $csharpLabel

9. 文件和支援

9.1 IronPDF 文件和支援

文件說明:IronPDF 提供全面的文件說明,涵蓋範圍廣泛的主題,包括入門指南及進階功能,如 HTML 轉換為 PDF、PDF 編輯、合併、拆分和安全性。 該文檔設計易於遵循,提供大量的代碼示例和解釋,引導開發人員在其 .NET 應用程式中實現各種與 PDF 相關的功能。

支援:IronPDF 為需要協助的開發人員提供各種管道的支援。 這包括電子郵件支持、工單支持和即時工程支持聊天,您可以聯繫他們的技術支持團隊以獲得特定問題的幫助。 您也可以使用支援系統提供反饋。

IronPDF 與 Apryse C# 的比較:圖 19 - Iron Software 支援團隊聊天

9.2 Apryse C# 文檔和支持

文件: Apryse C#(前稱為 PDFTron for .NET)擁有詳細的文件,包括全面的 API 參考、開發指南和用於各種 PDF 操作任務的範例代碼。

支持:Apryse 為開發者提供了一個支持系統,其中包括與技術團隊直接通過電子郵件獲得支持,以解決故障排除和實施問題。 您也可以在 Stack Overflow 上提問。

10. 授權資訊

10.1 IronPDF 授權

IronPDF 提供多種針對不同專案需求的授權選項,包括 Lite、Plus 和 Professional 授權,Lite 授權的價格從 $749 起。 這些授權根據涵蓋的開發人員數量、地點和專案而有所不同。 此外,IronPDF 提供免版稅重新分發選項,以及延長支援和更新,這些附加功能具有特定的費用。

IronPDF為開發者提供了一系列的永久許可選項:

  • 精簡版:價格為$749,適合1名開發者,1個地點和1個項目,包含電子郵件支援。
  • Plus Edition:售價為 $1,499,涵蓋多達 3 位開發人員、3 個地點和 3 個專案,並提供 24 小時電子郵件和聊天支援以及電話支援。
  • 專業版:售價2,999美元,此版本適用於最多10位開發人員、10個地點和10個專案,提供包括電子郵件、聊天、電話和螢幕共享支援的綜合支援。

    他們也提供每月500美元的訂閱服務,包括10,000次API調用,超過次數的調用則每次收費0.02美元。 IronPDF 提供企業解決方案並可應要求提供報價以供無限制使用。 此解決方案包括無限的永久授權和無限的 API 調用,以及其他功能。

    IronPDF 與 Apryse C# 的比較:圖 20 - IronPDF 許可證網頁

10.2 Apryse C# 授權

Apryse C# 提供可自訂的定價模型,根據特定專案需求調整,包括功能、文件量和部署場景。 您必須聯繫他們的銷售團隊以獲取Apryse 價格信息

IronPDF 與 Apryse C# 的比較:圖21 - Apryse 表單以便與其銷售團隊聯繫

11 結論

總之,IronPDF 和 Apryse C# 各自為處理 PDF 的 .NET 開發者帶來強大的功能。 然而,IronPDF 以其廣泛的 PDF 操作功能提供了優勢。 它以處理全面任務的能力而著稱,例如廣泛的編輯,使用 IronPDF 合併 PDF,這增加了它的吸引力。 透過使用 Iron Suite 套件,開發人員可以以具成本效益的價格獲取一整套工具,為各種開發需求提供強大的實用工具組合。

IronPDF 在大多數 PDF 處理情境中以其整體的多功能性和價值主張脫穎而出。 最終決策最好根據專案需求和開發人員所需的特定功能來制定。

Chipego
奇佩戈·卡林达
軟體工程師
Chipego 擁有天生的傾聽技能,這幫助他理解客戶問題,並提供智能解決方案。他在獲得信息技術理學學士學位後,于 2023 年加入 Iron Software 團隊。IronPDF 和 IronOCR 是 Chipego 專注的兩個產品,但隨著他每天找到新的方法來支持客戶,他對所有產品的了解也在不斷增長。他喜歡在 Iron Software 的協作生活,公司內的團隊成員從各自不同的經歷中共同努力,創造出有效的創新解決方案。當 Chipego 離開辦公桌時,他常常享受讀好書或踢足球的樂趣。
< 上一頁
IronPDF 與 PDFSharpCore 的比較
下一個 >
IronPDF與PdfPig的比較