IronPDF與Apryse C#的比較
Full Comparison
Looking for a detailed feature-by-feature breakdown? See how IronPDF stacks up against Apryse PDF on pricing, HTML support, and licensing.
為何要比較 IronPDF 與 Apryse 的 C# PDF 函式庫?
IronPDF 和 Apryse C# 是兩款知名的 .NET PDF 函式庫,各自具備獨特優勢。 IronPDF 在 HTML 轉 PDF 方面表現出色,不僅全面支援 Bootstrap,還具備豐富的編輯功能。 此外,Apryse 專精於文件註解與遮蔽處理,致力滿足 Enterprise 合規需求。
身為 C# 開發者,在建置會產生、編輯或顯示文件的應用程式時,您經常會面臨與 PDF 相關的任務。 可靠的 PDF 函式庫對於提升效率至關重要。 這些函式庫提供內建功能,可執行諸如轉換文件、編輯文字以及處理 PDF 內圖片等複雜操作。 若沒有這些工具,您將需要從頭開始編寫所有功能,這不僅耗時,且容易出錯。
本比較將探討兩款廣受歡迎的 PDF 函式庫:IronPDF 與 Apryse C#。 IronPDF 提供可靠的功能,可簡化 .NET 環境中的 PDF 操作,從 HTML 轉為 PDF 到進階文件編輯皆能勝任。 Apryse C# 提供了一種直觀的 PDF 處理方法,著重於效率與易用性。 本分析將深入探討各函式庫的具體功能,協助您為專案選擇最適合的解決方案。
什麼是 Apryse C# PDF 函式庫?
Apryse 的主頁展示了他們的文件處理 SDK,並在電腦顯示器上顯示了程式碼編輯器和文件檢視器介面。
Apryse C# 是一款專為 .NET 應用程式設計的完整 PDF 函式庫,旨在簡化 C# 環境中的 PDF 處理流程。 此產品前身為 PDFTron SDK,為尋求精準 PDF 處理能力的開發者提供廣泛的功能與工具。
Apryse C# 提供哪些主要功能?
- 輕鬆整合至 .NET 專案:可無縫整合至 .NET 環境,包括 ASP.NET Core 及傳統 .NET Framework 應用程式。
- 文件建立與編輯:從頭建立 PDF 或編輯現有檔案,包含文字、圖片、表單及頁面操作——重新排序、合併或分割。
- HTML 轉 PDF:將 HTML 內容直接轉換為 PDF 格式,適用於發票、報告及網頁文件。
- 廣泛的表單欄位支援:為自動化工作流程提供可靠的 PDF 表單欄位建立、編輯及程式化填寫功能。
- 文字與內容擷取:從 PDF 檔案中擷取文字與內容,供分析、搜尋工具及內容管理使用。
- 安全性與加密:全面的安全防護,包含文件加密、權限管理及數位簽章。
- 進階 PDF 功能:支援互動式 PDF 的註解、書籤及超連結。
什麼是 IronPDF C# 函式庫?
IronPDF 主頁展示了使用 NuGet 安裝指令將 HTML 轉換為 PDF 的 C# 程式碼範例
IronPDF 是一款專為 .NET 開發人員量身打造的多功能 PDF 函式庫。 它簡化了複雜的 PDF 處理流程,讓您能夠直接在 C# 應用程式中建立、編輯及轉換 PDF 文件。 IronPDF 支援多種程式語言,包括 Java、Python 和 C#,能以高效且可靠的方式滿足各種 PDF 處理需求。
IronPDF 提供哪些主要功能?
- 流暢的 .NET 整合:支援 .NET Framework 與 .NET Core(包括 ASP.NET 專案)的簡易整合。
- HTML 轉 PDF:將 HTML 轉換為高品質的 PDF 檔案,非常適合用於從 HTML 範本生成報告、收據及文件。
- 進階 PDF 編輯:具備廣泛的編輯功能,包括新增文字、圖片及向量圖形。
- PDF 表單處理:透過程式化方式建立、編輯及填寫 PDF 表單,以實現自動化文件工作流程。
- 內容擷取:擷取文字、圖片及元資料,以進行內容分析與資料遷移。
- 文件安全性:密碼保護、加密及權限管理。
- 效能與可擴展性:針對高需求應用程式,提升處理速度並強化大容量處理能力。
- 完整文件:提供詳盡的文件及反應迅速的支援團隊,協助您進行實作。
- PDF 標準相容性:支援 PDF/A、PDF/UA 及其他產業規範。
如何建立 C# 主控台應用程式?
在 Visual Studio 中建立主控台應用程式,將為 .NET 開發專案奠定基礎,包括那些使用 IronPDF 或 Apryse C# 等 PDF 函式庫的專案。 請依照以下步驟開始:
如何啟動 Visual Studio?
在您的電腦上打開 Visual Studio。 若您尚未安裝 Visual Studio,請從微軟官方網站下載並安裝,並根據您的需求選擇合適的版本。
如何建立新專案?
開啟 Visual Studio 後,請從初始儀表板中選取"建立新專案"。
Visual Studio 2022 啟動畫面顯示"開始使用"選單,其中包含複製儲存庫、開啟專案或解決方案、開啟本機資料夾或建立新專案的選項。
我應該選擇哪種專案類型?
在"建立新專案"視窗中,您將看到各種專案範本。 在搜尋框中輸入"Console",或從清單中找到"Console Application"。選擇專屬 C# 的範本。
Visual Studio 的"建立新專案"對話方塊顯示了各種 ASP.NET Core 和 C# 專案模板,包括控制台應用程式、Blazor Web 應用程式和 Web API 選項。
如何設定我的專案?
選取"主控台應用程式"後,請按"下一步"。設定您的新專案:
- 專案名稱:為您的專案輸入一個具描述性的名稱。
- 位置:選擇您偏好的儲存位置。
- 解決方案名稱:預設為您的專案名稱,但可自訂。
Visual Studio 專案設定畫面顯示建立名為"IronPDF vs Apryse"的新 C# 主機應用程式項目,並顯示專案位置和解決方案設定。
- 框架:請選擇您的 .NET 版本。 除非有特定要求,否則通常建議使用最新版本。
如何完成專案建立?
設定完專案設定後,請按一下"建立"。Visual Studio 會建立一個新的主控台應用程式專案,並包含預設的 Program.cs 檔案。
專案結構為何?
請在"解決方案總覽"窗格中探索生成的專案結構。 您主要會處理控制台應用程式的 Program.cs 檔案,並在此撰寫 C# 程式碼。
如何安裝 IronPDF 函式庫?
將 IronPDF 整合至您的 .NET 專案中,即可運用其完整的 PDF 處理功能。 多種安裝方式可根據您的工作流程偏好提供靈活性。
如何使用 NuGet 套件管理員進行安裝?
Visual Studio 中的 NuGet 套件管理員提供了一個用於管理函式庫的圖形化介面。
1.在 Visual Studio 中開啟您的專案。
- 在"解決方案總覽"中右鍵點擊您的專案,然後選擇"管理 NuGet 套件"。
- 點擊"瀏覽"標籤,並搜尋"IronPdf"。
- 從搜尋結果中選取 IronPDF,然後點擊"安裝"。
NuGet 套件管理器顯示 IronPDF 庫的搜尋結果,版本為 2024.2.2 及相關套件,包括特定於平台的 Chrome 依賴項和 IronPdf.Slim。
如何透過命令列進行安裝?
套件管理員主控台提供直接透過命令列進行安裝的功能。
- 開啟你的 Visual Studio 專案。 2.前往 Tools > NuGet Package Manager > Package Manager Console。
- 輸入以下指令:
Install-Package IronPdf
此指令會將最新版本的 IronPDF 安裝至您的專案中。
如何直接從 NuGet 下載?
您可以在整合前手動下載該套件。
1.請造訪 NuGet 網站,搜尋 "IronPDF"。
- 在IronPdf 軟體包頁面上,點選"下載軟體包"以取得 .nupkg 檔案。
- 透過解決方案資源管理器手動新增下載的套件 > 右鍵點選專案 > "新增 > 引用"。
每種方法都成功整合了 IronPDF,使您可以使用其高效的 PDF 處理功能。
如何安裝 Apryse C#?
將 Apryse C# 整合到您的專案中,會因您的 .NET Framework 或 .NET Core 環境而有所不同。 以下步驟概述了一般的安裝過程:
如何為 .NET Framework 安裝 Apryse?
1.下載適用於 Windows 的 Apryse SDK:您需要存取Apryse SDK for Windows 頁面,下載適用於 .NET Framework 應用程式的 SDK。
Apryse C# .NET PDF 庫下載頁面顯示了 SDK 下載按鈕和商業許可要求
2.解壓縮 SDK:下載後,將 SDK 解壓縮到系統上的一個已知位置。 3.取得 Apryse 試用金鑰:在 Apryse 平台上註冊以取得試用金鑰,您可以使用該金鑰啟動 SDK 的試用功能。 4.設定專案:在 Visual Studio 中建立一個新的 .NET Framework 控制台應用程式。 然後,將解壓縮 SDK 中的 Lib 資料夾加入專案目錄。 5.新增引用:右鍵單擊專案中的"引用",選擇"新增參考",然後導航到Lib資料夾,其中您已複製了PDFNetLoader.dll和適用於您的架構(x86 或 x64)的相應PDFNet.dll 。 確保將 PDFNet.dll 的"複製本機"屬性設為 false。 6.設定 App.config:確保您的 App.config 檔案中的loadFromRemoteSources設定已啟用為 true。
SDK 包含範例資料夾,您可以開啟這些資料夾並直接作為解決方案運行。 ## IronPDF 的進階功能
HTML 至 PDF 轉換
IronPDF 在將 HTML 轉換為 PDF 文件方面非常有效,這是產生報告、發票或網頁快照的 Web 應用程式的關鍵功能。 該程式庫能夠準確地渲染 HTML、CSS 和 JavaScript,並在生成的 PDF 中保留網頁內容的佈局和樣式。
將 HTML 字串轉換為 PDF
將 HTML 字串直接轉換為 PDF 可以實現從應用程式產生的內容或儲存的變數動態建立文件。 這種方法有利於根據使用者輸入建立自訂報表、收據或文件。
using IronPdf;
// Secure the server environment to disable local disk access or cross-origin requests
Installation.EnableWebSecurity = true;
// Set your IronPDF license key
IronPdf.License.LicenseKey = "License-Key goes here";
// Instantiate a PDF renderer
var renderer = new ChromePdfRenderer();
// Define a simple HTML string to convert to PDF
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>";
// Render the HTML string as a PDF
var pdf = renderer.RenderHtmlAsPdf(htmlContent);
// Save the resulting PDF to a file
pdf.SaveAs("output.pdf");
using IronPdf;
// Secure the server environment to disable local disk access or cross-origin requests
Installation.EnableWebSecurity = true;
// Set your IronPDF license key
IronPdf.License.LicenseKey = "License-Key goes here";
// Instantiate a PDF renderer
var renderer = new ChromePdfRenderer();
// Define a simple HTML string to convert to PDF
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>";
// Render the HTML string as a PDF
var pdf = renderer.RenderHtmlAsPdf(htmlContent);
// Save the resulting PDF to a file
pdf.SaveAs("output.pdf");
Imports IronPdf
' Secure the server environment to disable local disk access or cross-origin requests
Installation.EnableWebSecurity = True
' Set your IronPDF license key
IronPdf.License.LicenseKey = "License-Key goes here"
' Instantiate a PDF renderer
Dim renderer = New ChromePdfRenderer()
' Define a simple HTML string to convert to PDF
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>"
' Render the HTML string as a PDF
Dim pdf = renderer.RenderHtmlAsPdf(htmlContent)
' Save the resulting PDF to a file
pdf.SaveAs("output.pdf")
將 HTML 文件轉換為 PDF
如果您的磁碟上儲存有 HTML 文件,IronPDF 可以將這些文件轉換為 PDF 文件。 此方法非常適合保存在專案或伺服器中的現有 HTML 文件、範本或報告。
using IronPdf;
// Set your IronPDF license key
IronPdf.License.LicenseKey = "License-Key goes here";
// Secure the server environment to disable local disk access or cross-origin requests
Installation.EnableWebSecurity = true;
// Instantiate a PDF renderer
var renderer = new ChromePdfRenderer();
// Render the HTML file as a PDF
var pdf = renderer.RenderHtmlFileAsPdf("invoice.html");
// Save the resulting PDF to a file
pdf.SaveAs("file.pdf");
using IronPdf;
// Set your IronPDF license key
IronPdf.License.LicenseKey = "License-Key goes here";
// Secure the server environment to disable local disk access or cross-origin requests
Installation.EnableWebSecurity = true;
// Instantiate a PDF renderer
var renderer = new ChromePdfRenderer();
// Render the HTML file as a PDF
var pdf = renderer.RenderHtmlFileAsPdf("invoice.html");
// Save the resulting PDF to a file
pdf.SaveAs("file.pdf");
Imports IronPdf
' Set your IronPDF license key
IronPdf.License.LicenseKey = "License-Key goes here"
' Secure the server environment to disable local disk access or cross-origin requests
Installation.EnableWebSecurity = True
' Instantiate a PDF renderer
Dim renderer = New ChromePdfRenderer()
' Render the HTML file as a PDF
Dim pdf = renderer.RenderHtmlFileAsPdf("invoice.html")
' Save the resulting PDF to a file
pdf.SaveAs("file.pdf")
將 URL 轉換為 PDF
IronPDF 可以透過提供 URL 將即時網頁轉換為 PDF 文件。 此功能可擷取目前網頁狀態,包括複雜的佈局、CSS 和 JavaScript 產生的內容。
using IronPdf;
// Set your IronPDF license key
IronPdf.License.LicenseKey = "License-Key goes here";
// Secure the server environment to disable local disk access or cross-origin requests
Installation.EnableWebSecurity = true;
// Instantiate a PDF renderer
var renderer = new ChromePdfRenderer();
// Render the URL as a PDF
var pdf = renderer.RenderUrlAsPdf("___PROTECTED_URL_100___");
// Save the resulting PDF to a file
pdf.SaveAs("url.pdf");
using IronPdf;
// Set your IronPDF license key
IronPdf.License.LicenseKey = "License-Key goes here";
// Secure the server environment to disable local disk access or cross-origin requests
Installation.EnableWebSecurity = true;
// Instantiate a PDF renderer
var renderer = new ChromePdfRenderer();
// Render the URL as a PDF
var pdf = renderer.RenderUrlAsPdf("___PROTECTED_URL_100___");
// Save the resulting PDF to a file
pdf.SaveAs("url.pdf");
Imports IronPdf
' Set your IronPDF license key
IronPdf.License.LicenseKey = "License-Key goes here"
' Secure the server environment to disable local disk access or cross-origin requests
Installation.EnableWebSecurity = True
' Instantiate a PDF renderer
Dim renderer As New ChromePdfRenderer()
' Render the URL as a PDF
Dim pdf = renderer.RenderUrlAsPdf("___PROTECTED_URL_100___")
' Save the resulting PDF to a file
pdf.SaveAs("url.pdf")
支援 Bootstrap 和現代 CSS 框架
從現代 Web 應用程式產生 PDF 時,對 Bootstrap 和 CSS 框架的全面支援至關重要。 各組織機構都依賴 Bootstrap 來建立 Web 介面,因此準確地將其轉換為 PDF 對於報告、發票和文件至關重要。
IronPDF 支援的 Bootstrap 功能
IronPDF:完整的 Bootstrap 支援
- Bootstrap 5:完全支援 Flexbox 佈局、CSS Grid、實用類別和響應式元件
- Bootstrap 4:完整的卡片系統、導航組件和彈性實用程序 Tailwind CSS:所有實用類別都能準確渲染。 -基礎:完整的網格系統和組件支持 -現代 CSS3:完整的 flexbox、CSS Grid、自訂屬性、動畫和過渡效果
IronPDF 可以以像素級的精確度渲染 Bootstrap 主頁和所有官方範例。
程式碼範例:業務指標儀表板
using IronPdf;
// Set your IronPDF license key
IronPdf.License.LicenseKey = "License-Key goes here";
var renderer = new ChromePdfRenderer();
string bootstrapDashboard = @"
<!DOCTYPE html>
<html>
<head>
<link href='___PROTECTED_URL_101___ rel='stylesheet'>
<style>
.metric-card { transition: transform 0.2s; }
.metric-card:hover { transform: translateY(-5px); }
.trend-up { color: #28a745; }
.trend-down { color: #dc3545; }
</style>
</head>
<body>
<div class='container-fluid py-4'>
<div class='d-flex justify-content-between align-items-center mb-4'>
<h1 class='display-5'>Business Performance Dashboard</h1>
<div class='text-muted'>Last updated: March 2025</div>
</div>
<div class='row g-4 mb-4'>
<div class='col-md-3'>
<div class='card metric-card shadow-sm border-start border-primary border-4'>
<div class='card-body'>
<div class='d-flex justify-content-between align-items-center mb-2'>
<h6 class='text-muted text-uppercase mb-0'>Total Revenue</h6>
<span class='badge bg-primary'>Q1 2025</span>
</div>
<h2 class='mb-1'>$2.4M</h2>
<div class='trend-up'>
<i>↑</i> <strong>+18.5%</strong> from last quarter
</div>
</div>
</div>
</div>
<div class='col-md-3'>
<div class='card metric-card shadow-sm border-start border-success border-4'>
<div class='card-body'>
<div class='d-flex justify-content-between align-items-center mb-2'>
<h6 class='text-muted text-uppercase mb-0'>New Customers</h6>
<span class='badge bg-success'>Active</span>
</div>
<h2 class='mb-1'>1,284</h2>
<div class='trend-up'>
<i>↑</i> <strong>+24.3%</strong> growth rate
</div>
</div>
</div>
</div>
<div class='col-md-3'>
<div class='card metric-card shadow-sm border-start border-warning border-4'>
<div class='card-body'>
<div class='d-flex justify-content-between align-items-center mb-2'>
<h6 class='text-muted text-uppercase mb-0'>Avg Order Value</h6>
<span class='badge bg-warning text-dark'>Updated</span>
</div>
<h2 class='mb-1'>$1,847</h2>
<div class='trend-up'>
<i>↑</i> <strong>+5.2%</strong> increase
</div>
</div>
</div>
</div>
<div class='col-md-3'>
<div class='card metric-card shadow-sm border-start border-info border-4'>
<div class='card-body'>
<div class='d-flex justify-content-between align-items-center mb-2'>
<h6 class='text-muted text-uppercase mb-0'>Satisfaction Rate</h6>
<span class='badge bg-info'>Excellent</span>
</div>
<h2 class='mb-1'>94.7%</h2>
<div class='trend-up'>
<i>↑</i> <strong>+2.1pts</strong> improvement
</div>
</div>
</div>
</div>
</div>
<div class='row g-4'>
<div class='col-md-8'>
<div class='card shadow-sm'>
<div class='card-header bg-white d-flex justify-content-between align-items-center'>
<h5 class='mb-0'>Revenue Breakdown by Category</h5>
<div class='btn-group btn-group-sm' role='group'>
<button type='button' class='btn btn-outline-primary active'>Monthly</button>
<button type='button' class='btn btn-outline-primary'>Quarterly</button>
<button type='button' class='btn btn-outline-primary'>Annual</button>
</div>
</div>
<div class='card-body'>
<div class='table-responsive'>
<table class='table table-hover mb-0'>
<thead class='table-light'>
<tr>
<th>Category</th>
<th>Revenue</th>
<th>Orders</th>
<th>Avg Value</th>
<th class='text-end'>Trend</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class='badge bg-primary me-2'>A</span>Enterprise Solutions</td>
<td><strong>$1,245,000</strong></td>
<td>142</td>
<td>$8,768</td>
<td class='text-end'><span class='badge bg-success'>+12%</span></td>
</tr>
<tr>
<td><span class='badge bg-success me-2'>B</span>Professional Services</td>
<td><strong>$687,500</strong></td>
<td>458</td>
<td>$1,501</td>
<td class='text-end'><span class='badge bg-success'>+18%</span></td>
</tr>
<tr>
<td><span class='badge bg-info me-2'>C</span>Standard Packages</td>
<td><strong>$412,300</strong></td>
<td>891</td>
<td>$463</td>
<td class='text-end'><span class='badge bg-success'>+8%</span></td>
</tr>
<tr>
<td><span class='badge bg-warning me-2'>D</span>Custom Development</td>
<td><strong>$55,200</strong></td>
<td>12</td>
<td>$4,600</td>
<td class='text-end'><span class='badge bg-danger'>-3%</span></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
<div class='col-md-4'>
<div class='card shadow-sm'>
<div class='card-header bg-white'>
<h5 class='mb-0'>Quick Actions</h5>
</div>
<div class='card-body'>
<div class='d-grid gap-2'>
<button class='btn btn-primary'>Generate Full Report</button>
<button class='btn btn-outline-primary'>Export to Excel</button>
<button class='btn btn-outline-secondary'>Schedule Email</button>
<button class='btn btn-outline-info'>Share Dashboard</button>
</div>
</div>
</div>
<div class='card shadow-sm mt-3'>
<div class='card-header bg-white'>
<h5 class='mb-0'>Key Insights</h5>
</div>
<div class='card-body'>
<div class='alert alert-success mb-2'>
<small><strong>Top Performer:</strong> Enterprise Solutions leading revenue growth</small>
</div>
<div class='alert alert-info mb-2'>
<small><strong>Growth Driver:</strong> Professional Services showing strongest customer acquisition</small>
</div>
<div class='alert alert-warning mb-0'>
<small><strong>Attention Needed:</strong> Custom Development segment requires review</small>
</div>
</div>
</div>
</div>
</div>
</div>
</body>
</html>";
var pdf = renderer.RenderHtmlAsPdf(bootstrapDashboard);
pdf.SaveAs("business-dashboard.pdf");
using IronPdf;
// Set your IronPDF license key
IronPdf.License.LicenseKey = "License-Key goes here";
var renderer = new ChromePdfRenderer();
string bootstrapDashboard = @"
<!DOCTYPE html>
<html>
<head>
<link href='___PROTECTED_URL_101___ rel='stylesheet'>
<style>
.metric-card { transition: transform 0.2s; }
.metric-card:hover { transform: translateY(-5px); }
.trend-up { color: #28a745; }
.trend-down { color: #dc3545; }
</style>
</head>
<body>
<div class='container-fluid py-4'>
<div class='d-flex justify-content-between align-items-center mb-4'>
<h1 class='display-5'>Business Performance Dashboard</h1>
<div class='text-muted'>Last updated: March 2025</div>
</div>
<div class='row g-4 mb-4'>
<div class='col-md-3'>
<div class='card metric-card shadow-sm border-start border-primary border-4'>
<div class='card-body'>
<div class='d-flex justify-content-between align-items-center mb-2'>
<h6 class='text-muted text-uppercase mb-0'>Total Revenue</h6>
<span class='badge bg-primary'>Q1 2025</span>
</div>
<h2 class='mb-1'>$2.4M</h2>
<div class='trend-up'>
<i>↑</i> <strong>+18.5%</strong> from last quarter
</div>
</div>
</div>
</div>
<div class='col-md-3'>
<div class='card metric-card shadow-sm border-start border-success border-4'>
<div class='card-body'>
<div class='d-flex justify-content-between align-items-center mb-2'>
<h6 class='text-muted text-uppercase mb-0'>New Customers</h6>
<span class='badge bg-success'>Active</span>
</div>
<h2 class='mb-1'>1,284</h2>
<div class='trend-up'>
<i>↑</i> <strong>+24.3%</strong> growth rate
</div>
</div>
</div>
</div>
<div class='col-md-3'>
<div class='card metric-card shadow-sm border-start border-warning border-4'>
<div class='card-body'>
<div class='d-flex justify-content-between align-items-center mb-2'>
<h6 class='text-muted text-uppercase mb-0'>Avg Order Value</h6>
<span class='badge bg-warning text-dark'>Updated</span>
</div>
<h2 class='mb-1'>$1,847</h2>
<div class='trend-up'>
<i>↑</i> <strong>+5.2%</strong> increase
</div>
</div>
</div>
</div>
<div class='col-md-3'>
<div class='card metric-card shadow-sm border-start border-info border-4'>
<div class='card-body'>
<div class='d-flex justify-content-between align-items-center mb-2'>
<h6 class='text-muted text-uppercase mb-0'>Satisfaction Rate</h6>
<span class='badge bg-info'>Excellent</span>
</div>
<h2 class='mb-1'>94.7%</h2>
<div class='trend-up'>
<i>↑</i> <strong>+2.1pts</strong> improvement
</div>
</div>
</div>
</div>
</div>
<div class='row g-4'>
<div class='col-md-8'>
<div class='card shadow-sm'>
<div class='card-header bg-white d-flex justify-content-between align-items-center'>
<h5 class='mb-0'>Revenue Breakdown by Category</h5>
<div class='btn-group btn-group-sm' role='group'>
<button type='button' class='btn btn-outline-primary active'>Monthly</button>
<button type='button' class='btn btn-outline-primary'>Quarterly</button>
<button type='button' class='btn btn-outline-primary'>Annual</button>
</div>
</div>
<div class='card-body'>
<div class='table-responsive'>
<table class='table table-hover mb-0'>
<thead class='table-light'>
<tr>
<th>Category</th>
<th>Revenue</th>
<th>Orders</th>
<th>Avg Value</th>
<th class='text-end'>Trend</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class='badge bg-primary me-2'>A</span>Enterprise Solutions</td>
<td><strong>$1,245,000</strong></td>
<td>142</td>
<td>$8,768</td>
<td class='text-end'><span class='badge bg-success'>+12%</span></td>
</tr>
<tr>
<td><span class='badge bg-success me-2'>B</span>Professional Services</td>
<td><strong>$687,500</strong></td>
<td>458</td>
<td>$1,501</td>
<td class='text-end'><span class='badge bg-success'>+18%</span></td>
</tr>
<tr>
<td><span class='badge bg-info me-2'>C</span>Standard Packages</td>
<td><strong>$412,300</strong></td>
<td>891</td>
<td>$463</td>
<td class='text-end'><span class='badge bg-success'>+8%</span></td>
</tr>
<tr>
<td><span class='badge bg-warning me-2'>D</span>Custom Development</td>
<td><strong>$55,200</strong></td>
<td>12</td>
<td>$4,600</td>
<td class='text-end'><span class='badge bg-danger'>-3%</span></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
<div class='col-md-4'>
<div class='card shadow-sm'>
<div class='card-header bg-white'>
<h5 class='mb-0'>Quick Actions</h5>
</div>
<div class='card-body'>
<div class='d-grid gap-2'>
<button class='btn btn-primary'>Generate Full Report</button>
<button class='btn btn-outline-primary'>Export to Excel</button>
<button class='btn btn-outline-secondary'>Schedule Email</button>
<button class='btn btn-outline-info'>Share Dashboard</button>
</div>
</div>
</div>
<div class='card shadow-sm mt-3'>
<div class='card-header bg-white'>
<h5 class='mb-0'>Key Insights</h5>
</div>
<div class='card-body'>
<div class='alert alert-success mb-2'>
<small><strong>Top Performer:</strong> Enterprise Solutions leading revenue growth</small>
</div>
<div class='alert alert-info mb-2'>
<small><strong>Growth Driver:</strong> Professional Services showing strongest customer acquisition</small>
</div>
<div class='alert alert-warning mb-0'>
<small><strong>Attention Needed:</strong> Custom Development segment requires review</small>
</div>
</div>
</div>
</div>
</div>
</div>
</body>
</html>";
var pdf = renderer.RenderHtmlAsPdf(bootstrapDashboard);
pdf.SaveAs("business-dashboard.pdf");
Imports IronPdf
' Set your IronPDF license key
IronPdf.License.LicenseKey = "License-Key goes here"
Dim renderer As New ChromePdfRenderer()
Dim bootstrapDashboard As String = "
<!DOCTYPE html>
<html>
<head>
<link href='___PROTECTED_URL_101___ rel='stylesheet'>
<style>
.metric-card { transition: transform 0.2s; }
.metric-card:hover { transform: translateY(-5px); }
.trend-up { color: #28a745; }
.trend-down { color: #dc3545; }
</style>
</head>
<body>
<div class='container-fluid py-4'>
<div class='d-flex justify-content-between align-items-center mb-4'>
<h1 class='display-5'>Business Performance Dashboard</h1>
<div class='text-muted'>Last updated: March 2025</div>
</div>
<div class='row g-4 mb-4'>
<div class='col-md-3'>
<div class='card metric-card shadow-sm border-start border-primary border-4'>
<div class='card-body'>
<div class='d-flex justify-content-between align-items-center mb-2'>
<h6 class='text-muted text-uppercase mb-0'>Total Revenue</h6>
<span class='badge bg-primary'>Q1 2025</span>
</div>
<h2 class='mb-1'>$2.4M</h2>
<div class='trend-up'>
<i>↑</i> <strong>+18.5%</strong> from last quarter
</div>
</div>
</div>
</div>
<div class='col-md-3'>
<div class='card metric-card shadow-sm border-start border-success border-4'>
<div class='card-body'>
<div class='d-flex justify-content-between align-items-center mb-2'>
<h6 class='text-muted text-uppercase mb-0'>New Customers</h6>
<span class='badge bg-success'>Active</span>
</div>
<h2 class='mb-1'>1,284</h2>
<div class='trend-up'>
<i>↑</i> <strong>+24.3%</strong> growth rate
</div>
</div>
</div>
</div>
<div class='col-md-3'>
<div class='card metric-card shadow-sm border-start border-warning border-4'>
<div class='card-body'>
<div class='d-flex justify-content-between align-items-center mb-2'>
<h6 class='text-muted text-uppercase mb-0'>Avg Order Value</h6>
<span class='badge bg-warning text-dark'>Updated</span>
</div>
<h2 class='mb-1'>$1,847</h2>
<div class='trend-up'>
<i>↑</i> <strong>+5.2%</strong> increase
</div>
</div>
</div>
</div>
<div class='col-md-3'>
<div class='card metric-card shadow-sm border-start border-info border-4'>
<div class='card-body'>
<div class='d-flex justify-content-between align-items-center mb-2'>
<h6 class='text-muted text-uppercase mb-0'>Satisfaction Rate</h6>
<span class='badge bg-info'>Excellent</span>
</div>
<h2 class='mb-1'>94.7%</h2>
<div class='trend-up'>
<i>↑</i> <strong>+2.1pts</strong> improvement
</div>
</div>
</div>
</div>
</div>
<div class='row g-4'>
<div class='col-md-8'>
<div class='card shadow-sm'>
<div class='card-header bg-white d-flex justify-content-between align-items-center'>
<h5 class='mb-0'>Revenue Breakdown by Category</h5>
<div class='btn-group btn-group-sm' role='group'>
<button type='button' class='btn btn-outline-primary active'>Monthly</button>
<button type='button' class='btn btn-outline-primary'>Quarterly</button>
<button type='button' class='btn btn-outline-primary'>Annual</button>
</div>
</div>
<div class='card-body'>
<div class='table-responsive'>
<table class='table table-hover mb-0'>
<thead class='table-light'>
<tr>
<th>Category</th>
<th>Revenue</th>
<th>Orders</th>
<th>Avg Value</th>
<th class='text-end'>Trend</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class='badge bg-primary me-2'>A</span>Enterprise Solutions</td>
<td><strong>$1,245,000</strong></td>
<td>142</td>
<td>$8,768</td>
<td class='text-end'><span class='badge bg-success'>+12%</span></td>
</tr>
<tr>
<td><span class='badge bg-success me-2'>B</span>Professional Services</td>
<td><strong>$687,500</strong></td>
<td>458</td>
<td>$1,501</td>
<td class='text-end'><span class='badge bg-success'>+18%</span></td>
</tr>
<tr>
<td><span class='badge bg-info me-2'>C</span>Standard Packages</td>
<td><strong>$412,300</strong></td>
<td>891</td>
<td>$463</td>
<td class='text-end'><span class='badge bg-success'>+8%</span></td>
</tr>
<tr>
<td><span class='badge bg-warning me-2'>D</span>Custom Development</td>
<td><strong>$55,200</strong></td>
<td>12</td>
<td>$4,600</td>
<td class='text-end'><span class='badge bg-danger'>-3%</span></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
<div class='col-md-4'>
<div class='card shadow-sm'>
<div class='card-header bg-white'>
<h5 class='mb-0'>Quick Actions</h5>
</div>
<div class='card-body'>
<div class='d-grid gap-2'>
<button class='btn btn-primary'>Generate Full Report</button>
<button class='btn btn-outline-primary'>Export to Excel</button>
<button class='btn btn-outline-secondary'>Schedule Email</button>
<button class='btn btn-outline-info'>Share Dashboard</button>
</div>
</div>
</div>
<div class='card shadow-sm mt-3'>
<div class='card-header bg-white'>
<h5 class='mb-0'>Key Insights</h5>
</div>
<div class='card-body'>
<div class='alert alert-success mb-2'>
<small><strong>Top Performer:</strong> Enterprise Solutions leading revenue growth</small>
</div>
<div class='alert alert-info mb-2'>
<small><strong>Growth Driver:</strong> Professional Services showing strongest customer acquisition</small>
</div>
<div class='alert alert-warning mb-0'>
<small><strong>Attention Needed:</strong> Custom Development segment requires review</small>
</div>
</div>
</div>
</div>
</div>
</div>
</body>
</html>"
Dim pdf = renderer.RenderHtmlAsPdf(bootstrapDashboard)
pdf.SaveAs("business-dashboard.pdf")
輸出:專業的商業儀錶板 PDF,採用 Bootstrap 5 的 flexbox 網格系統、帶邊框實用程式的卡片組件、徽章元素、響應式表格和顏色編碼的指標——所有元素均以完美的佈局保留和排版進行渲染。
Apryse 的 CSS 框架局限性
Apryse 的 HTML2PDF 模組使用自訂的渲染引擎 (非 Chromium),並有記錄的限制:
-部分 Flexbox 支援: Bootstrap 4/5 佈局可能無法正確渲染。
- CSS Grid 功能有限:現代基於網格的設計經常失敗
- JavaScript 限制:與瀏覽器環境相比,執行量最小 -框架相容性:需要對 Bootstrap 元件進行廣泛的測試
HTML2PDF 文件明確警告,複雜的 CSS 可能無法如預期渲染。 開發者報告稱導覽列、基於 flex 的卡片佈局和響應式實用程式存在問題。
開發影響:使用 Apryse 的團隊必須建立並行的"PDF 安全"CSS 或大幅簡化 Bootstrap 佈局,這會增加開發開銷並限制 Web 和 PDF 輸出之間的設計一致性。
若要獲得完整的 Bootstrap 框架支援和完整的 CSS3 渲染,請參閱Bootstrap 和 Flexbox CSS 指南。
合併和拆分PDF
IronPDF 讓合併多個 PDF 文件或將 PDF 分割成更小的文件變得簡單易行。 對於需要組織有序的PDF內容結構的文件管理系統而言,此功能至關重要。
using IronPdf;
// Set your IronPDF license key
IronPdf.License.LicenseKey = "License-Key goes here";
// Secure the server environment to disable local disk access or cross-origin requests
Installation.EnableWebSecurity = true;
// Define HTML content for two PDFs to merge
var htmlA = @"
<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 htmlB = @"
<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>";
// Instantiate a PDF renderer
var renderer = new ChromePdfRenderer();
// Render the HTML content as separate PDF documents
var pdfDocA = renderer.RenderHtmlAsPdf(htmlA);
var pdfDocB = renderer.RenderHtmlAsPdf(htmlB);
// Merge the two PDFs into one
var mergedPdf = PdfDocument.Merge(pdfDocA, pdfDocB);
// Save the merged PDF to a file
mergedPdf.SaveAs("Merged.pdf");
using IronPdf;
// Set your IronPDF license key
IronPdf.License.LicenseKey = "License-Key goes here";
// Secure the server environment to disable local disk access or cross-origin requests
Installation.EnableWebSecurity = true;
// Define HTML content for two PDFs to merge
var htmlA = @"
<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 htmlB = @"
<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>";
// Instantiate a PDF renderer
var renderer = new ChromePdfRenderer();
// Render the HTML content as separate PDF documents
var pdfDocA = renderer.RenderHtmlAsPdf(htmlA);
var pdfDocB = renderer.RenderHtmlAsPdf(htmlB);
// Merge the two PDFs into one
var mergedPdf = PdfDocument.Merge(pdfDocA, pdfDocB);
// Save the merged PDF to a file
mergedPdf.SaveAs("Merged.pdf");
Imports IronPdf
' Set your IronPDF license key
IronPdf.License.LicenseKey = "License-Key goes here"
' Secure the server environment to disable local disk access or cross-origin requests
Installation.EnableWebSecurity = True
' Define HTML content for two PDFs to merge
Dim htmlA = "
<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 htmlB = "
<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>"
' Instantiate a PDF renderer
Dim renderer = New ChromePdfRenderer()
' Render the HTML content as separate PDF documents
Dim pdfDocA = renderer.RenderHtmlAsPdf(htmlA)
Dim pdfDocB = renderer.RenderHtmlAsPdf(htmlB)
' Merge the two PDFs into one
Dim mergedPdf = PdfDocument.Merge(pdfDocA, pdfDocB)
' Save the merged PDF to a file
mergedPdf.SaveAs("Merged.pdf")
在PDF中加入浮水印
IronPDF 允許您在 PDF 頁面中新增浮水印,用於品牌宣傳或將文件標記為機密。 該庫能夠處理文字和圖像浮水印的複雜性,從而在應用和顯示方面提供靈活性。
using IronPdf;
// Set your IronPDF license key
IronPdf.License.LicenseKey = "License-Key goes here";
// Secure the server environment to disable local disk access or cross-origin requests
Installation.EnableWebSecurity = true;
// Instantiate a PDF renderer
var renderer = new ChromePdfRenderer();
// Render a URL as a PDF
var pdf = renderer.RenderUrlAsPdf("___PROTECTED_URL_102___");
// Apply a watermark to the PDF
pdf.ApplyWatermark("<h2 style='color:red'>SAMPLE</h2>", 30, IronPdf.Editing.VerticalAlignment.Middle, IronPdf.Editing.HorizontalAlignment.Center);
// Save the watermarked PDF to a file
pdf.SaveAs("Watermarked.pdf");
```### How Do I Work with PDF Forms?
IronPDF supports complete [interactive PDF form handling](https://ironpdf.com/how-to/create-forms/). You can create, fill, and submit PDF forms programmatically, which is particularly useful for automating form processing or integrating form data collection into your workflows.
```csharp
using IronPdf;
// Set your IronPDF license key
IronPdf.License.LicenseKey = "License-Key goes here";
// Secure the server environment to disable local disk access or cross-origin requests
Installation.EnableWebSecurity = true;
// Define HTML content with form elements
const string formHtml = @"
<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 a PDF renderer
var renderer = new ChromePdfRenderer();
renderer.RenderingOptions.CreatePdfFormsFromHtml = true;
// Render the HTML form content as a PDF
renderer.RenderHtmlAsPdf(formHtml).SaveAs("EmployeeInfoForm.pdf");
using IronPdf;
// Set your IronPDF license key
IronPdf.License.LicenseKey = "License-Key goes here";
// Secure the server environment to disable local disk access or cross-origin requests
Installation.EnableWebSecurity = true;
// Instantiate a PDF renderer
var renderer = new ChromePdfRenderer();
// Render a URL as a PDF
var pdf = renderer.RenderUrlAsPdf("___PROTECTED_URL_102___");
// Apply a watermark to the PDF
pdf.ApplyWatermark("<h2 style='color:red'>SAMPLE</h2>", 30, IronPdf.Editing.VerticalAlignment.Middle, IronPdf.Editing.HorizontalAlignment.Center);
// Save the watermarked PDF to a file
pdf.SaveAs("Watermarked.pdf");
```### How Do I Work with PDF Forms?
IronPDF supports complete [interactive PDF form handling](https://ironpdf.com/how-to/create-forms/). You can create, fill, and submit PDF forms programmatically, which is particularly useful for automating form processing or integrating form data collection into your workflows.
```csharp
using IronPdf;
// Set your IronPDF license key
IronPdf.License.LicenseKey = "License-Key goes here";
// Secure the server environment to disable local disk access or cross-origin requests
Installation.EnableWebSecurity = true;
// Define HTML content with form elements
const string formHtml = @"
<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 a PDF renderer
var renderer = new ChromePdfRenderer();
renderer.RenderingOptions.CreatePdfFormsFromHtml = true;
// Render the HTML form content as a PDF
renderer.RenderHtmlAsPdf(formHtml).SaveAs("EmployeeInfoForm.pdf");
Imports IronPdf
' Set your IronPDF license key
IronPdf.License.LicenseKey = "License-Key goes here"
' Secure the server environment to disable local disk access or cross-origin requests
Installation.EnableWebSecurity = True
' Instantiate a PDF renderer
Dim renderer As New ChromePdfRenderer()
' Render a URL as a PDF
Dim pdf = renderer.RenderUrlAsPdf("___PROTECTED_URL_102___")
' Apply a watermark to the PDF
pdf.ApplyWatermark("<h2 style='color:red'>SAMPLE</h2>", 30, IronPdf.Editing.VerticalAlignment.Middle, IronPdf.Editing.HorizontalAlignment.Center)
' Save the watermarked PDF to a file
pdf.SaveAs("Watermarked.pdf")
Imports IronPdf
' Set your IronPDF license key
IronPdf.License.LicenseKey = "License-Key goes here"
' Secure the server environment to disable local disk access or cross-origin requests
Installation.EnableWebSecurity = True
' Define HTML content with form elements
Const formHtml 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 a PDF renderer
Dim renderer As New ChromePdfRenderer()
renderer.RenderingOptions.CreatePdfFormsFromHtml = True
' Render the HTML form content as a PDF
renderer.RenderHtmlAsPdf(formHtml).SaveAs("EmployeeInfoForm.pdf")
如何保護和加密PDF文件?
IronPDF 提供可靠的功能來保護 PDF 文件,包括加密、權限設定和數位簽章。 這些措施可確保敏感資訊的安全保護和文件的完整性維護。
using IronPdf;
// Set your IronPDF license key
IronPdf.License.LicenseKey = "License-Key goes here";
// Secure the server environment to disable local disk access or cross-origin requests
Installation.EnableWebSecurity = true;
// Load an existing PDF file
var pdf = PdfDocument.FromFile("invoice.pdf");
// Set document security settings
pdf.SecuritySettings.OwnerPassword = "top-secret"; // Password to edit the PDF
pdf.SecuritySettings.UserPassword = "sharable"; // Password to open the PDF
// Save the secured PDF to a file
pdf.SaveAs("secured.pdf");
using IronPdf;
// Set your IronPDF license key
IronPdf.License.LicenseKey = "License-Key goes here";
// Secure the server environment to disable local disk access or cross-origin requests
Installation.EnableWebSecurity = true;
// Load an existing PDF file
var pdf = PdfDocument.FromFile("invoice.pdf");
// Set document security settings
pdf.SecuritySettings.OwnerPassword = "top-secret"; // Password to edit the PDF
pdf.SecuritySettings.UserPassword = "sharable"; // Password to open the PDF
// Save the secured PDF to a file
pdf.SaveAs("secured.pdf");
Imports IronPdf
' Set your IronPDF license key
IronPdf.License.LicenseKey = "License-Key goes here"
' Secure the server environment to disable local disk access or cross-origin requests
Installation.EnableWebSecurity = True
' Load an existing PDF file
Dim pdf = PdfDocument.FromFile("invoice.pdf")
' Set document security settings
pdf.SecuritySettings.OwnerPassword = "top-secret" ' Password to edit the PDF
pdf.SecuritySettings.UserPassword = "sharable" ' Password to open the PDF
' Save the secured PDF to a file
pdf.SaveAs("secured.pdf")
有哪些進階編輯選項?
IronPDF 除了提供基本修改功能外,還提供進階編輯功能。 這些功能包括新增頁首和頁尾、自訂頁面佈局以及嵌入圖像和字體。 這些功能支援動態產生 PDF 文件,並可根據特定應用需求進行客製化。
using IronPdf;
// Set your IronPDF license key
IronPdf.License.LicenseKey = "License-Key goes here";
// Secure the server environment to disable local disk access or cross-origin requests
Installation.EnableWebSecurity = true;
// Instantiate a PDF renderer
var renderer = new IronPdf.ChromePdfRenderer();
// Define multi-page HTML content with page breaks
var multiPageHtml = @"
<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>";
// Render the HTML content as a PDF
var pdfDoc = renderer.RenderHtmlAsPdf(multiPageHtml);
// Create a header for the first page only
var firstPageHeader = new HtmlHeaderFooter();
firstPageHeader.HtmlFragment = "This is the First Page Header";
pdfDoc.AddHtmlHeaders(firstPageHeader, 1);
// Save the resulting PDF with headers to a file
pdfDoc.SaveAs("PagesWithHeaders.pdf");
using IronPdf;
// Set your IronPDF license key
IronPdf.License.LicenseKey = "License-Key goes here";
// Secure the server environment to disable local disk access or cross-origin requests
Installation.EnableWebSecurity = true;
// Instantiate a PDF renderer
var renderer = new IronPdf.ChromePdfRenderer();
// Define multi-page HTML content with page breaks
var multiPageHtml = @"
<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>";
// Render the HTML content as a PDF
var pdfDoc = renderer.RenderHtmlAsPdf(multiPageHtml);
// Create a header for the first page only
var firstPageHeader = new HtmlHeaderFooter();
firstPageHeader.HtmlFragment = "This is the First Page Header";
pdfDoc.AddHtmlHeaders(firstPageHeader, 1);
// Save the resulting PDF with headers to a file
pdfDoc.SaveAs("PagesWithHeaders.pdf");
Imports IronPdf
' Set your IronPDF license key
IronPdf.License.LicenseKey = "License-Key goes here"
' Secure the server environment to disable local disk access or cross-origin requests
Installation.EnableWebSecurity = True
' Instantiate a PDF renderer
Dim renderer = New IronPdf.ChromePdfRenderer()
' Define multi-page HTML content with page breaks
Dim multiPageHtml = "
<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>"
' Render the HTML content as a PDF
Dim pdfDoc = renderer.RenderHtmlAsPdf(multiPageHtml)
' Create a header for the first page only
Dim firstPageHeader = New HtmlHeaderFooter()
firstPageHeader.HtmlFragment = "This is the First Page Header"
pdfDoc.AddHtmlHeaders(firstPageHeader, 1)
' Save the resulting PDF with headers to a file
pdfDoc.SaveAs("PagesWithHeaders.pdf")
! PDF 檢視器顯示一個兩頁的文檔,第 1 頁為"這是第一頁頁眉",第 1 頁為"這是第 1 頁"作為內容,左側邊欄中顯示頁面縮圖。
Apryse C# 提供哪些進階功能?
如何新增註解和標記?
Apryse C# 可讓您以程式設計方式為 PDF 文件新增註解和標記。 這包括文字註釋、高亮顯示、底線和形狀——對於文件審查過程或添加補充資訊至關重要。
using pdftron;
using pdftron.PDF;
using pdftron.SDF;
class Program
{
static void Main()
{
// Initialize the PDFNet library with your license key
PDFNet.Initialize("License");
// Open an existing PDF document
using (PDFDoc doc = new PDFDoc("input.pdf"))
{
// Access the first page of the document
Page page = doc.GetPage(1);
// Create a text annotation on the document
Text txt = Text.Create(doc, new Rect(10, 20, 30, 40));
txt.SetIcon("UserIcon");
txt.SetContents("It's an annotation!");
page.AnnotPushBack(txt);
// Save the modified document
doc.Save("output.pdf", SDFDoc.SaveOptions.e_linearized);
}
}
}
using pdftron;
using pdftron.PDF;
using pdftron.SDF;
class Program
{
static void Main()
{
// Initialize the PDFNet library with your license key
PDFNet.Initialize("License");
// Open an existing PDF document
using (PDFDoc doc = new PDFDoc("input.pdf"))
{
// Access the first page of the document
Page page = doc.GetPage(1);
// Create a text annotation on the document
Text txt = Text.Create(doc, new Rect(10, 20, 30, 40));
txt.SetIcon("UserIcon");
txt.SetContents("It's an annotation!");
page.AnnotPushBack(txt);
// Save the modified document
doc.Save("output.pdf", SDFDoc.SaveOptions.e_linearized);
}
}
}
Imports pdftron
Imports pdftron.PDF
Imports pdftron.SDF
Friend Class Program
Shared Sub Main()
' Initialize the PDFNet library with your license key
PDFNet.Initialize("License")
' Open an existing PDF document
Using doc As New PDFDoc("input.pdf")
' Access the first page of the document
Dim page As Page = doc.GetPage(1)
' Create a text annotation on the document
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)
' Save the modified document
doc.Save("output.pdf", SDFDoc.SaveOptions.e_linearized)
End Using
End Sub
End Class
如何將文件轉換為PDF格式?
Apryse C# 能夠將各種文件格式轉換為 PDF,包括Office 文件、圖像和 HTML。 此功能可確保歸檔、共用或顯示文件時採用統一的文件格式。
using pdftron;
using pdftron.PDF;
class Program
{
static void Main()
{
// Initialize the PDFNet library
PDFNet.Initialize();
// Create a new PDF document
PDFDoc pdfdoc = new PDFDoc();
// Convert a Word document to PDF and add it to the PDF document
Convert.ToPdf(pdfdoc, "input.docx");
// Save the newly created PDF document
pdfdoc.Save("output.pdf", SDFDoc.SaveOptions.e_linearized);
}
}
using pdftron;
using pdftron.PDF;
class Program
{
static void Main()
{
// Initialize the PDFNet library
PDFNet.Initialize();
// Create a new PDF document
PDFDoc pdfdoc = new PDFDoc();
// Convert a Word document to PDF and add it to the PDF document
Convert.ToPdf(pdfdoc, "input.docx");
// Save the newly created PDF document
pdfdoc.Save("output.pdf", SDFDoc.SaveOptions.e_linearized);
}
}
Imports pdftron
Imports pdftron.PDF
Friend Class Program
Shared Sub Main()
' Initialize the PDFNet library
PDFNet.Initialize()
' Create a new PDF document
Dim pdfdoc As New PDFDoc()
' Convert a Word document to PDF and add it to the PDF document
Convert.ToPdf(pdfdoc, "input.docx")
' Save the newly created PDF document
pdfdoc.Save("output.pdf", SDFDoc.SaveOptions.e_linearized)
End Sub
End Class
如何從PDF文件中提取內容?
Apryse C# 擅長從 PDF 文件中提取文字、圖像和其他內容。 此功能支援內容分析、資料擷取和資訊檢索應用,從而實現高效的 PDF 內容處理。
using pdftron;
using pdftron.PDF;
using pdftron.SDF;
class Program
{
static void Main()
{
// Initialize the PDFNet library
PDFNet.Initialize();
// Open an existing PDF document
using (PDFDoc doc = new PDFDoc("input.pdf"))
{
// Iterate through each page of the document
PageIterator itr = doc.GetPageIterator();
for (; itr.HasNext(); itr.Next())
{
Page page = itr.Current();
// Extract text from the page
TextExtractor txt = new TextExtractor();
txt.Begin(page);
// Print the extracted text to the console
Console.WriteLine(txt.GetAsText());
}
}
}
}
using pdftron;
using pdftron.PDF;
using pdftron.SDF;
class Program
{
static void Main()
{
// Initialize the PDFNet library
PDFNet.Initialize();
// Open an existing PDF document
using (PDFDoc doc = new PDFDoc("input.pdf"))
{
// Iterate through each page of the document
PageIterator itr = doc.GetPageIterator();
for (; itr.HasNext(); itr.Next())
{
Page page = itr.Current();
// Extract text from the page
TextExtractor txt = new TextExtractor();
txt.Begin(page);
// Print the extracted text to the console
Console.WriteLine(txt.GetAsText());
}
}
}
}
Imports pdftron
Imports pdftron.PDF
Imports pdftron.SDF
Friend Class Program
Shared Sub Main()
' Initialize the PDFNet library
PDFNet.Initialize()
' Open an existing PDF document
Using doc As New PDFDoc("input.pdf")
' Iterate through each page of the document
Dim itr As PageIterator = doc.GetPageIterator()
Do While itr.HasNext()
Dim page As Page = itr.Current()
' Extract text from the page
Dim txt As New TextExtractor()
txt.Begin(page)
' Print the extracted text to the console
Console.WriteLine(txt.GetAsText())
itr.Next()
Loop
End Using
End Sub
End Class
控制台輸出顯示提取的發票文字數據,包括發票編號 INV-001、日期 2024 年 2 月 14 日、客戶 John Doe 以及產品詳情,總價為 35.00 美元。
如何使用 Apryse 保護 PDF 檔案?
Apryse C# 提供用於保護 PDF 文件的完整工具。 您可以套用密碼保護、加密文件和管理使用者權限來保護敏感資訊。
using pdftron;
using pdftron.SDF;
using pdftron.PDF;
class Program
{
static void Main()
{
// Initialize the PDFNet library
PDFNet.Initialize();
// Open an existing PDF document
using (PDFDoc doc = new PDFDoc("input.pdf"))
{
// Initialize the security handler
doc.InitSecurityHandler();
// Create a new security handler
SecurityHandler newHandler = new SecurityHandler();
// Set the user password for the document
newHandler.ChangeUserPassword("new_password");
// Grant permission to print the document
newHandler.SetPermission(SecurityHandler.Permission.e_print, true);
// Apply the security handler to the document
doc.SetSecurityHandler(newHandler);
// Save the secured document
doc.Save("output.pdf", SDFDoc.SaveOptions.e_linearized);
}
}
}
using pdftron;
using pdftron.SDF;
using pdftron.PDF;
class Program
{
static void Main()
{
// Initialize the PDFNet library
PDFNet.Initialize();
// Open an existing PDF document
using (PDFDoc doc = new PDFDoc("input.pdf"))
{
// Initialize the security handler
doc.InitSecurityHandler();
// Create a new security handler
SecurityHandler newHandler = new SecurityHandler();
// Set the user password for the document
newHandler.ChangeUserPassword("new_password");
// Grant permission to print the document
newHandler.SetPermission(SecurityHandler.Permission.e_print, true);
// Apply the security handler to the document
doc.SetSecurityHandler(newHandler);
// Save the secured document
doc.Save("output.pdf", SDFDoc.SaveOptions.e_linearized);
}
}
}
Imports pdftron
Imports pdftron.SDF
Imports pdftron.PDF
Friend Class Program
Shared Sub Main()
' Initialize the PDFNet library
PDFNet.Initialize()
' Open an existing PDF document
Using doc As New PDFDoc("input.pdf")
' Initialize the security handler
doc.InitSecurityHandler()
' Create a new security handler
Dim newHandler As New SecurityHandler()
' Set the user password for the document
newHandler.ChangeUserPassword("new_password")
' Grant permission to print the document
newHandler.SetPermission(SecurityHandler.Permission.e_print, True)
' Apply the security handler to the document
doc.SetSecurityHandler(newHandler)
' Save the secured document
doc.Save("output.pdf", SDFDoc.SaveOptions.e_linearized)
End Using
End Sub
End Class
如何刪除敏感資訊?
Apryse C# 支援從 PDF 文件中刪除敏感資訊—這對於合規性和隱私問題至關重要。 此功能允許永久刪除或模糊PDF中的文字和圖像。
using pdftron;
using pdftron.PDF;
using pdftron.SDF;
class Program
{
static void Main()
{
// Initialize the PDFNet library
PDFNet.Initialize();
// Open an existing PDF document
using (PDFDoc doc = new PDFDoc("input.pdf"))
{
// Define redaction areas on specific pages
Redactor.Redaction[] redactions = {
new Redactor.Redaction(1, new Rect(100, 100, 200, 200), false, "redacted"),
};
// Apply redactions to the document
Redactor.Redact(doc, redactions);
// Save the redacted document
doc.Save("output.pdf", SDFDoc.SaveOptions.e_linearized);
}
}
}
using pdftron;
using pdftron.PDF;
using pdftron.SDF;
class Program
{
static void Main()
{
// Initialize the PDFNet library
PDFNet.Initialize();
// Open an existing PDF document
using (PDFDoc doc = new PDFDoc("input.pdf"))
{
// Define redaction areas on specific pages
Redactor.Redaction[] redactions = {
new Redactor.Redaction(1, new Rect(100, 100, 200, 200), false, "redacted"),
};
// Apply redactions to the document
Redactor.Redact(doc, redactions);
// Save the redacted document
doc.Save("output.pdf", SDFDoc.SaveOptions.e_linearized);
}
}
}
Imports pdftron
Imports pdftron.PDF
Imports pdftron.SDF
Friend Class Program
Shared Sub Main()
' Initialize the PDFNet library
PDFNet.Initialize()
' Open an existing PDF document
Using doc As New PDFDoc("input.pdf")
' Define redaction areas on specific pages
Dim redactions() As Redactor.Redaction = { New Redactor.Redaction(1, New Rect(100, 100, 200, 200), False, "redacted")}
' Apply redactions to the document
Redactor.Redact(doc, redactions)
' Save the redacted document
doc.Save("output.pdf", SDFDoc.SaveOptions.e_linearized)
End Using
End Sub
End Class
有哪些文件和支援服務?
IronPDF提供哪些支援?
文件: IronPDF 提供完整的文檔,涵蓋從入門指南到高級功能(如HTML 到 PDF 轉換、 PDF 編輯、合併、分割和安全性)等主題。 該文件提供了易於理解的內容,包含大量的程式碼範例和解釋,指導您完成各種 PDF 功能的實現。
支援: IronPDF 透過多種管道提供協助,包括電子郵件支援、工單支援和線上工程支援聊天,您可以透過這些管道與他們的技術團隊聯繫,解決具體問題。 您的應用程式可以立即受益於他們的回饋系統。
Apryse C# 提供哪些支援?
文件: Apryse C#(以前稱為 PDFTron for .NET)提供詳細的文檔,包括完整的 API 參考、開發人員指南和各種 PDF 操作任務的範例程式碼。
支援: Apryse 為開發者提供電子郵件支持,開發者可以透過與技術團隊的直接溝通來解決故障排除和實施方面的問題。 您也可以在 Stack Overflow 上提出問題。
有哪些授權選項和定價?
IronPDF有哪些許可選項?
IronPDF提供多種許可選項,以滿足不同的專案需求。 Lite 許可證的起價為 $799。 這些許可證根據開發者數量、地點和涵蓋的項目而有所不同。 IronPDF 還提供免版稅的再分發選項和擴展支持,附加組件有特定的定價。
IronPDF的永久許可選項包括:
- Lite Edition:價格為 $799,適合 1 位開發者、1 個地點和 1 個項目,包含電子郵件支援。
- Plus 版本:定價為 $1,199,支援最多 3 位開發者、3 個地點和 3 個項目,提供 24 小時電子郵件和聊天支援以及電話支援。 -專業版:在 $2,399,此版本最多可供 10 位開發人員、10 個地點和 10 個項目使用,提供全面的支持,包括電子郵件、聊天、電話和螢幕共享支援。
他們還提供每月 500 美元的訂閱服務,其中包括 10,000 次 API 調用,額外調用每次收費 0.02 美元。 若需無限次使用,IronPDF 提供基於報價的 Enterprise 解決方案。 此解決方案包含無限次永久授權及 API 呼叫等其他功能。
Apryse C# 有哪些授權選項?
Apryse C# 提供可根據特定專案需求(包括功能、文件數量及部署情境)進行客製化的定價方案。 有關 Apryse 的定價資訊,請聯繫其銷售團隊。
我該選擇哪個 PDF 函式庫?
IronPDF 與 Apryse C# 皆為處理 PDF 檔案的 .NET 開發人員提供了強大的功能。 IronPDF 憑藉其豐富的 PDF 處理功能,為您提供競爭優勢。 其功能完備,包括透過 IronPDF 進行的全面編輯與 PDF 合併功能。 Iron Suite 套件讓您能以經濟實惠的價格使用多種工具,為您的開發工作提供滿足各種需求的可靠實用程式。
IronPDF 因其在大多數 PDF 處理情境中的整體通用性和價值主張而脫穎而出。 您的最終決定應符合專案需求,並考量開發過程中所需的具體功能。
常見問題解答
IronPDF 和 Apryse C# 之間在 PDF 操作方面的主要區別是什麼?
IronPDF 以其與 .NET 的無縫集成及其在 HTML 轉 PDF 轉換、表單處理和安全功能方面的先進能力而聞名。而 Apryse C#(前身為 PDFTron SDK)則專注於內容提取和文檔轉換,提供如註釋和遮蓋等高級功能。
如何在 .NET 應用程序中將 HTML 轉換為 PDF?
您可以使用 IronPDF 庫的 RenderHtmlAsPdf 方法,將 HTML 字串直接轉換為 PDF 文件。這對於從網頁內容或 HTML 模板生成 PDF 非常有用。
在 .NET 項目中安裝 IronPDF 的步驟有哪些?
IronPDF 可以通過 Visual Studio 中的 NuGet 包管理器輕鬆安裝。您還可以使用包管理器控制台執行命令 Install-Package IronPDF,或直接從 NuGet 網站下載。
IronPDF 如何處理 PDF 的安全性和加密?
IronPDF 提供全面的安全選擇,包括加密文件、設置用戶權限和管理數字簽名的能力。這確保了 PDF 文件受到保護並符合安全標準。
IronPDF 提供哪些高級 PDF 編輯功能?
IronPDF 支持一系列高級編輯功能,包括合併和拆分文件、添加水印以及自訂頁眉和頁腳。它還提供布局自訂選項,以便更好地創建文件。
IronPDF 用戶有哪些支援和資源可用?
IronPDF 提供全面的文件、電子郵件支援、基於票據的支援和工程師實時聊天,以幫助開發人員進行實施和故障排除。這確保用戶擁有有效處理 PDF 所需的資源。
IronPDF 的許可選擇有哪些?
IronPDF 提供多種許可選項,包括 Lite、Plus 和 Professional 許可,滿足不同級別的支援和開發人員需求。還有每月訂閱模式和企業解決方案可供廣泛使用。
如何使用 Apryse C# 從 PDF 中提取文本?
Apryse C# 提供了強大的文本提取功能,允許開發人員程式化地從 PDF 中提取內容。這對於需要數據分析或內容操作的應用程序至關重要。
Apryse C# 可以將哪些文檔格式轉換為 PDF?
Apryse C# 支持將各種文檔格式,包括 Office 文檔、圖片和 HTML 文件,轉換為 PDF。這對於在不同平台上保持文檔展示的一致性至關重要。
IronPDF 為 .NET 開發人員提供的關鍵功能是什麼?
IronPDF 以其進階功能如 HTML 到 PDF 轉換、全面的表單處理和文檔安全性而聞名。它因其性能、可擴展性以及與 .NET 的無縫集成而受到讚譽,這使其成為廣泛的 PDF 處理場景的理想選擇。

