IronPDF與SelectPdf:完整的.NET Core PDF庫比較HTML到PDF轉換
您應該選擇哪個 PDF 函式庫來進行 .NET Core HTML 到 PDF 的轉換?
在開發需要產生 PDF 的 .NET 應用程式時,選擇正確的函式庫會大大影響專案的成功。 無論您是在建立企業報表系統、為小型企業產生發票,或是為個別專案建立文件,您所選擇的 PDF 函式庫都會影響從開發速度到生產效能的一切。
本綜合比較研究了 IronPDF 和 SelectPdf 這兩個廣受歡迎的 .NET PDF 函式庫,協助您根據實際使用情況、功能和價值做出明智的決定。
快速概述:IronPDF vs SelectPdf for .NET 開發人員。
IronPDF 為 .NET 生態系統提供全面的 PDF 解決方案,提供 HTML 到 PDF 的無縫轉換,並完全支援現代網路標準。 建立在 Chrome 演算引擎上,可確保像素完美的精確度,同時支援 HTML5、CSS3 和 JavaScript。 除了轉換之外,IronPDF 還提供廣泛的 PDF 操作功能,包括編輯、簽署、加密和跨平台部署選項。
SelectPdf 專精於 .NET 應用程式的 HTML 至 PDF 轉換,同時支援 .NET Framework 和 .NET Core 平台。 雖然 SelectPdf 提供基本的 PDF 產生與處理功能,但它主要著重於 Windows 環境,跨平台功能有限。
| 類別 | 功能/外觀 | IronPDF | SelectPdf | 優勝者 |
|---|---|---|---|---|
| 核心架構 | 設計理念 | 開發人員第一、直覺式 API | 傳統 PDF 生成方式 | IronPDF:更快的開發速度 |
| API 的複雜性 | 像 RenderHtmlAsPdf() 之類的簡單方法 |
直接但有限的 API | IronPDF:更直觀 | |
| 學習曲線 | 小時生產力 | 進階功能的天數 | IronPDF:快速採用 | |
| 平台支援 | 跨平台 | Windows、Linux、macOS、Docker | 僅限 Windows | IronPDF:真正的可攜性 |
| .NET 版本 | .NET 10、9、8、7、6、Core、框架 | .NET Core 2.0+,.NET Framework 4.0+ | IronPDF:最新框架支援 | |
| 雲端平台 | Azure、AWS、Google Cloud 準備就緒 | 有限的 Azure 支援 (Basic+) | IronPDF:雲端原生 | |
| 容器支援 | 原生 Docker 支援 | 不支援 Docker | IronPDF:現代部署 | |
| HTML 至 PDF 渲染 | 渲染引擎 | Chrome V8 引擎 | WebKit/Blink 混合型 | IronPDF:更高的精確度 |
| 支援 CSS3/HTML5 | 100% 現代標準 | 良好但不完整 | IronPDF:完全符合規範 | |
| JavaScript 執行 | 完整的 JavaScript 支援 | 有限的 JavaScript 支援 | IronPDF:動態內容 | |
| 渲染速度 | 大多數頁面的翻譯時間在秒以內 | 一般為 2-3 秒 | IronPDF:速度快 3 倍 | |
| PDF 安全性 | 加密 | AES-256、自訂處理器 | 標準加密 | 兩者:行業標準 |
| 數位簽名 | 簡單、穩健的實現 | 複雜的手動設定 | IronPDF:更輕鬆的簽署 | |
| 權限 | 粒度控制 | 基本權限 | IronPDF:更多選項 | |
| 內容編輯 | 編輯 | 內建刪節工具 | 不支援 | IronPDF:合規性就緒 |
| 添加水印 | 基於 HTML/CSS,完全控制 | 以模板為基礎的方法 | IronPDF:更靈活 | |
| 文字/圖像沖印 | 統一的 stamper 類別 | 多種範本類型 | IronPDF:一致的 API | |
| 檔案轉換 | DOCX 到 PDF | 原生支援 | 不支援 | IronPDF:更多格式 |
| 影像到 PDF | 支援多種格式 | 基本圖像支援 | IronPDF:多用途 | |
| PDF 轉換為圖片 | 高品質的光柵化 | 支援 | 兩者皆有:可用 | |
| 效能 | 大型文件 | 針對規模進行最佳化 | 報告的效能問題 | IronPDF:更佳的規模 |
| 記憶體使用 | 高效快取 | 較高的記憶體消耗 | IronPDF:更低的佔用率 | |
| 非同步支援 | 原生 async/await | 有限的 async 支援 | IronPDF:現代模式 | |
| 開發人員經驗 | 文件 | 廣泛的教學、範例 | 基本文件 | IronPDF:更好的資源 |
| 代碼範例 | 100+ 個即時可用的範例 | 有限的範例 | IronPDF:更多指導 | |
| API 設計 | 直覺、流暢的介面 | 傳統方法 | IronPDF:開發人員友善 | |
| Licensing & Pricing | 入門級 | Lite: $999 (1 dev) | 單次:$499 (1 位開發人員) | SelectPdf:較低的入口 |
| Team License | Plus: $1,499 (3 位開發人員) | 5-Dev: $799 (5 位開發人員) | SelectPdf:更多的開發人員/美元 | |
| 企業 | Professional: $2,999 (10 位開發人員) | 企業版:$1,199(無限制) | SelectPdf:降低企業 | |
| 再發行 | +$2,999 royalty-free | 提供 OEM 授權 | 兩者皆有:可供選擇 | |
| <強>支援強 | 支援包括 | 24/5 工程支援 | 僅提供電子郵件支援 | IronPDF:更好的支援 |
| 回應時間 | 一般需時 24-48 小時 | 回應時間不定 | IronPDF:可預測的 SLA | |
| 更新內容 | 每月發佈 | 每兩年發佈一次 | IronPDF:更頻繁 | |
| 最適合 | 用例 | 現代應用程式、雲端、跨平台 | 僅限 Windows,簡單轉換 | 依據上下文 |
| 團隊規模 | 任何規模、可擴充的授權 | 中小型團隊 | IronPDF:更靈活 |
跨平台相容性如何比較?
IronPDF:專為現代開發而打造。
IronPDF 採用現代開發實踐,提供全面的平台支援。 無論您是部署到傳統伺服器或容器化環境,IronPDF 都能適應您的基礎架構需求。
支援的 .NET 版本:
- C#、VB.NET、F#
- .NET 10、9、8、7、6、Core (3.1+)
- .NET Standard (2.0+)
- .NET Framework (4.6.2+)
部署環境:
- 作業系統: Windows、Linux、macOS
- 雲端平台: Azure (所有層級)、AWS (EC2、Lambda)、Google Cloud
- 容器: Docker (Windows & Linux 容器)
- 開發工具: Visual Studio、JetBrains Rider、VS Code
這種廣泛的相容性意味著您可以一次開發、隨處部署,這對使用微服務架構或混合雲部署的團隊而言至關重要。 準備好查看 IronPDF 在您的環境中如何運作了嗎? 立即下載函式庫並進行測試。
SelectPdf:以 Windows 為重點的解決方案。
SelectPdf 採用較傳統的方式,主要著重於 Windows 環境:
支援的 .NET 版本:
- .NET Framework 4.0+
- .NET Core 2.1+ (透過 .NET Standard 2.0)
- .NET 5-8(僅限 Windows)
部署限制:
- 作業系統:僅限 Windows (不支援 Linux/macOS)
- 雲端平台:有限的 Azure 支援 (基本層以上)
- 容器:不支援 Docker
- 注意限制:不適用於 Azure Functions 或無伺服器架構
根據 SelectPdf 的說明文件,"SelectPdf 目前僅能在 Windows 系統上運作。 不支援 Linux、Xamarin 或其他平台"。對於採用現代 DevOps 實務或雲原生架構的團隊而言,這項限制可能是一大挑戰。
哪個函式庫能提供更好的 HTML 至 PDF 轉換?
HTML 至 PDF 的轉換品質
這兩個函式庫的核心功能都是以 HTML 轉換為 PDF 為中心,但它們的方法和結果有很大的不同。
IronPDF範例:
using IronPdf;
// Instantiate Chrome-based renderer for pixel-perfect accuracy
var renderer = new ChromePdfRenderer();
// Configure rendering options for optimal output
renderer.RenderingOptions.CssMediaType = PdfCssMediaType.Print;
renderer.RenderingOptions.PrintHtmlBackgrounds = true;
renderer.RenderingOptions.CreatePdfFormsFromHtml = true;
// Convert HTML with full CSS3, JavaScript, and web font support
var pdf = renderer.RenderHtmlAsPdf(@"
<html>
<head>
<link href='https://fonts.googleapis.com/css?family=Roboto' rel='stylesheet'>
<style>
body { font-family: 'Roboto', sans-serif; }
.chart { width: 100%; height: 400px; }
</style>
</head>
<body>
<h1>Modern Web Standards in PDF</h1>
<canvas id='chart' class='chart'></canvas>
<script>
// JavaScript executes before PDF generation
// Perfect for dynamic charts and content
</script>
</body>
</html>");
// Save with professional quality
pdf.SaveAs("modern-output.pdf");
using IronPdf;
// Instantiate Chrome-based renderer for pixel-perfect accuracy
var renderer = new ChromePdfRenderer();
// Configure rendering options for optimal output
renderer.RenderingOptions.CssMediaType = PdfCssMediaType.Print;
renderer.RenderingOptions.PrintHtmlBackgrounds = true;
renderer.RenderingOptions.CreatePdfFormsFromHtml = true;
// Convert HTML with full CSS3, JavaScript, and web font support
var pdf = renderer.RenderHtmlAsPdf(@"
<html>
<head>
<link href='https://fonts.googleapis.com/css?family=Roboto' rel='stylesheet'>
<style>
body { font-family: 'Roboto', sans-serif; }
.chart { width: 100%; height: 400px; }
</style>
</head>
<body>
<h1>Modern Web Standards in PDF</h1>
<canvas id='chart' class='chart'></canvas>
<script>
// JavaScript executes before PDF generation
// Perfect for dynamic charts and content
</script>
</body>
</html>");
// Save with professional quality
pdf.SaveAs("modern-output.pdf");
Imports IronPdf
' Instantiate Chrome-based renderer for pixel-perfect accuracy
Private renderer = New ChromePdfRenderer()
' Configure rendering options for optimal output
renderer.RenderingOptions.CssMediaType = PdfCssMediaType.Print
renderer.RenderingOptions.PrintHtmlBackgrounds = True
renderer.RenderingOptions.CreatePdfFormsFromHtml = True
' Convert HTML with full CSS3, JavaScript, and web font support
Dim pdf = renderer.RenderHtmlAsPdf("
<html>
<head>
<link href='https://fonts.googleapis.com/css?family=Roboto' rel='stylesheet'>
<style>
body { font-family: 'Roboto', sans-serif; }
.chart { width: 100%; height: 400px; }
</style>
</head>
<body>
<h1>Modern Web Standards in PDF</h1>
<canvas id='chart' class='chart'></canvas>
<script>
// JavaScript executes before PDF generation
// Perfect for dynamic charts and content
</script>
</body>
</html>")
' Save with professional quality
pdf.SaveAs("modern-output.pdf")
ChromePdfRenderer 類別利用了與 Google Chrome 相同的渲染引擎,確保您的 PDF 與使用者在瀏覽器中看到的內容完全一致。 此方法支援 CSS Grid、Flexbox、Canvas 元素等現代網路功能,以及 React 或 Angular 等複雜 JavaScript 框架。 如需詳細的實作指南,請參閱 HTML轉換為PDF的文件。
SelectPdf範例:
using SelectPdf;
// Create converter instance
HtmlToPdf converter = new HtmlToPdf();
// Basic configuration options
converter.Options.PdfPageSize = PdfPageSize.A4;
converter.Options.WebPageWidth = 1024;
converter.Options.WebPageHeight = 0; // Auto-detect
// Convert HTML string
PdfDocument doc = converter.ConvertHtmlString(htmlString);
// Save document
doc.Save("output.pdf");
doc.Close();
using SelectPdf;
// Create converter instance
HtmlToPdf converter = new HtmlToPdf();
// Basic configuration options
converter.Options.PdfPageSize = PdfPageSize.A4;
converter.Options.WebPageWidth = 1024;
converter.Options.WebPageHeight = 0; // Auto-detect
// Convert HTML string
PdfDocument doc = converter.ConvertHtmlString(htmlString);
// Save document
doc.Save("output.pdf");
doc.Close();
Imports SelectPdf
' Create converter instance
Private converter As New HtmlToPdf()
' Basic configuration options
converter.Options.PdfPageSize = PdfPageSize.A4
converter.Options.WebPageWidth = 1024
converter.Options.WebPageHeight = 0 ' Auto-detect
' Convert HTML string
Dim doc As PdfDocument = converter.ConvertHtmlString(htmlString)
' Save document
doc.Save("output.pdf")
doc.Close()
雖然 SelectPdf 的 API 簡單易懂,但開發人員反映在現代網路標準上受到限制。 根據 GitHub 的討論,轉換效能可能會很慢,使用者表示簡單文件的轉換時間為 3 秒。 圖書館也要努力處理 CSS3 功能和 JavaScript 較多的內容。
效能基準
真實世界的效能測試顯示出顯著的差異:
- IronPDF: 標準網頁的次秒轉換
- SelectPdf:一般為 2-3 秒,有報告指出在生產伺服器上會延遲 3.5 分鐘。
在 IronPDF性能指南中瞭解有關優化PDF生成性能的更多資訊。
現代 CSS 架構相容性:Bootstrap、Tailwind 及其他。
在函式庫評估過程中,有一個經常被忽略的重要考量,就是對現代 CSS 框架的支援。 隨著 Bootstrap、Tailwind CSS 和 Foundation 為數百萬的 Web 應用程式提供動力,以 PDF 格式準確呈現這些框架的能力可決定您的實作成敗。
IronPDF:原生現代框架支援
IronPDF 的 Chrome 渲染引擎可為所有當代 CSS 框架提供無縫支援:
- Bootstrap 5:完全支援 flexbox 和 CSS Grid 渲染,實現響應式佈局 Tailwind CSS:完全支援實用類,並提供正確的間距和排版 -基礎:進階 CSS3 功能可實現像素級完美渲染。 -實際驗證:成功渲染Bootstrap 首頁和Bootstrap 模板
程式碼範例:Bootstrap 警報元件
using IronPdf;
var renderer = new ChromePdfRenderer();
string bootstrapAlerts = @"
<!DOCTYPE html>
<html>
<head>
<link href='https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css' rel='stylesheet'>
</head>
<body>
<div class='container my-5'>
<h2 class='mb-4'>System Notifications</h2>
<div class='alert alert-success d-flex align-items-center' role='alert'>
<svg class='bi flex-shrink-0 me-2' width='24' height='24'>
<use xlink:href='#check-circle-fill'/>
</svg>
<div>Payment processed successfully!</div>
</div>
<div class='alert alert-warning d-flex align-items-center' role='alert'>
<svg class='bi flex-shrink-0 me-2' width='24' height='24'>
<use xlink:href='#exclamation-triangle-fill'/>
</svg>
<div>Your subscription expires in 7 days.</div>
</div>
<div class='alert alert-info d-flex align-items-center' role='alert'>
<svg class='bi flex-shrink-0 me-2' width='24' height='24'>
<use xlink:href='#info-fill'/>
</svg>
<div>New features available in the dashboard.</div>
</div>
</div>
</body>
</html>";
var pdf = renderer.RenderHtmlAsPdf(bootstrapAlerts);
pdf.SaveAs("bootstrap-alerts.pdf");
using IronPdf;
var renderer = new ChromePdfRenderer();
string bootstrapAlerts = @"
<!DOCTYPE html>
<html>
<head>
<link href='https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css' rel='stylesheet'>
</head>
<body>
<div class='container my-5'>
<h2 class='mb-4'>System Notifications</h2>
<div class='alert alert-success d-flex align-items-center' role='alert'>
<svg class='bi flex-shrink-0 me-2' width='24' height='24'>
<use xlink:href='#check-circle-fill'/>
</svg>
<div>Payment processed successfully!</div>
</div>
<div class='alert alert-warning d-flex align-items-center' role='alert'>
<svg class='bi flex-shrink-0 me-2' width='24' height='24'>
<use xlink:href='#exclamation-triangle-fill'/>
</svg>
<div>Your subscription expires in 7 days.</div>
</div>
<div class='alert alert-info d-flex align-items-center' role='alert'>
<svg class='bi flex-shrink-0 me-2' width='24' height='24'>
<use xlink:href='#info-fill'/>
</svg>
<div>New features available in the dashboard.</div>
</div>
</div>
</body>
</html>";
var pdf = renderer.RenderHtmlAsPdf(bootstrapAlerts);
pdf.SaveAs("bootstrap-alerts.pdf");
Imports IronPdf
Dim renderer As New ChromePdfRenderer()
Dim bootstrapAlerts As String = "
<!DOCTYPE html>
<html>
<head>
<link href='https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css' rel='stylesheet'>
</head>
<body>
<div class='container my-5'>
<h2 class='mb-4'>System Notifications</h2>
<div class='alert alert-success d-flex align-items-center' role='alert'>
<svg class='bi flex-shrink-0 me-2' width='24' height='24'>
<use xlink:href='#check-circle-fill'/>
</svg>
<div>Payment processed successfully!</div>
</div>
<div class='alert alert-warning d-flex align-items-center' role='alert'>
<svg class='bi flex-shrink-0 me-2' width='24' height='24'>
<use xlink:href='#exclamation-triangle-fill'/>
</svg>
<div>Your subscription expires in 7 days.</div>
</div>
<div class='alert alert-info d-flex align-items-center' role='alert'>
<svg class='bi flex-shrink-0 me-2' width='24' height='24'>
<use xlink:href='#info-fill'/>
</svg>
<div>New features available in the dashboard.</div>
</div>
</div>
</body>
</html>"
Dim pdf = renderer.RenderHtmlAsPdf(bootstrapAlerts)
pdf.SaveAs("bootstrap-alerts.pdf")
SelectPdf:有限的現代 CSS 支援
SelectPdf 使用 WebKit/Blink 混合引擎,並針對現代 CSS 框架提供文件限制:
- Flexbox 支援不完整: Bootstrap 4 及更高版本的佈局可能無法正確渲染。
- CSS Grid 問題:現代基於網格的佈局經常無法正確顯示。 -效能下降:複雜的 Bootstrap 佈局會顯著增加轉換時間 -樣式不一致:根據開發者報告,Bootstrap 元件經常需要 CSS 變通方案。
常見問題報告:
- Bootstrap 導覽列渲染不正確
- 使用 flexbox 的卡片元件顯示錯位
- 不尊重回應式網格中斷點
- 需要手動調整的自訂 Bootstrap 主題
變通方法:使用 SelectPdf 和 Bootstrap 的開發者通常需要: 1.建立簡化、印刷專用的版面設計版本 2.避免使用 flexbox,改用基於表格的佈局 3.廣泛測試每個 Bootstrap 元件 4.為 PDF 生成保持獨立的 CSS
對於已經使用 Bootstrap 作為網頁介面的應用程式而言,這種變通方式會大幅增加開發和維護成本。
有關 CSS 架構相容性的詳細資訊,請參閱 Bootstrap & Flexbox CSS 指南。
不同程式庫的安全功能如何比較?
PDF 加密和保護
這兩個函式庫都提供加密功能,但實作複雜度各有不同:
IronPDF 安全性實作:
using IronPdf;
using IronPdf.Security;
// Load or create a PDF document
var pdf = PdfDocument.FromFile("sensitive-document.pdf");
// Apply comprehensive security settings
pdf.SecuritySettings.RemovePasswordsAnd加密();
pdf.SecuritySettings.UserPassword = "user123";
pdf.SecuritySettings.OwnerPassword = "owner456";
// Granular permission control
pdf.SecuritySettings.AllowUserPrinting = PdfPrintSecurity.NoPrint;
pdf.SecuritySettings.AllowUserEditing = false;
pdf.SecuritySettings.AllowUserCopyPasteContent = false;
pdf.SecuritySettings.AllowUserFormData = true;
pdf.SecuritySettings.AllowUserAnnotations = false;
// Use 256-bit AES encryption
pdf.SecuritySettings.加密Level = 加密Level.AES256Bit;
pdf.SaveAs("secured.pdf");
using IronPdf;
using IronPdf.Security;
// Load or create a PDF document
var pdf = PdfDocument.FromFile("sensitive-document.pdf");
// Apply comprehensive security settings
pdf.SecuritySettings.RemovePasswordsAnd加密();
pdf.SecuritySettings.UserPassword = "user123";
pdf.SecuritySettings.OwnerPassword = "owner456";
// Granular permission control
pdf.SecuritySettings.AllowUserPrinting = PdfPrintSecurity.NoPrint;
pdf.SecuritySettings.AllowUserEditing = false;
pdf.SecuritySettings.AllowUserCopyPasteContent = false;
pdf.SecuritySettings.AllowUserFormData = true;
pdf.SecuritySettings.AllowUserAnnotations = false;
// Use 256-bit AES encryption
pdf.SecuritySettings.加密Level = 加密Level.AES256Bit;
pdf.SaveAs("secured.pdf");
Imports IronPdf
Imports IronPdf.Security
' Load or create a PDF document
Dim pdf = PdfDocument.FromFile("sensitive-document.pdf")
' Apply comprehensive security settings
pdf.SecuritySettings.RemovePasswordsAndEncryption()
pdf.SecuritySettings.UserPassword = "user123"
pdf.SecuritySettings.OwnerPassword = "owner456"
' Granular permission control
pdf.SecuritySettings.AllowUserPrinting = PdfPrintSecurity.NoPrint
pdf.SecuritySettings.AllowUserEditing = False
pdf.SecuritySettings.AllowUserCopyPasteContent = False
pdf.SecuritySettings.AllowUserFormData = True
pdf.SecuritySettings.AllowUserAnnotations = False
' Use 256-bit AES encryption
pdf.SecuritySettings.EncryptionLevel = EncryptionLevel.AES256Bit
pdf.SaveAs("secured.pdf")
IronPDF 的 SecuritySettings 類別為所有安全操作提供統一的介面。 API 設計遵循 .NET 慣例,讓熟悉該框架的開發人員可以直覺地使用。 在 PDF安全性文件中探索先進的安全性功能。
SelectPdf 安全組態:
using SelectPdf;
PdfDocument doc = new PdfDocument();
// Set document passwords
doc.Security.OwnerPassword = "owner456";
doc.Security.UserPassword = "user123";
// Configure permissions
doc.Security.CanPrint = false;
doc.Security.CanEditContent = false;
doc.Security.CanCopyContent = false;
doc.Security.CanEditAnnotations = false;
doc.Security.CanFillFormFields = true;
doc.Security.CanAssembleDocument = false;
doc.Save("secured.pdf");
doc.Close();
using SelectPdf;
PdfDocument doc = new PdfDocument();
// Set document passwords
doc.Security.OwnerPassword = "owner456";
doc.Security.UserPassword = "user123";
// Configure permissions
doc.Security.CanPrint = false;
doc.Security.CanEditContent = false;
doc.Security.CanCopyContent = false;
doc.Security.CanEditAnnotations = false;
doc.Security.CanFillFormFields = true;
doc.Security.CanAssembleDocument = false;
doc.Save("secured.pdf");
doc.Close();
Imports SelectPdf
Private doc As New PdfDocument()
' Set document passwords
doc.Security.OwnerPassword = "owner456"
doc.Security.UserPassword = "user123"
' Configure permissions
doc.Security.CanPrint = False
doc.Security.CanEditContent = False
doc.Security.CanCopyContent = False
doc.Security.CanEditAnnotations = False
doc.Security.CanFillFormFields = True
doc.Security.CanAssembleDocument = False
doc.Save("secured.pdf")
doc.Close()
這兩個函式庫都支援業界標準的加密功能,但 IronPDF 提供更細緻的列印權限控制,並支援自訂加密處理程式以滿足特殊需求。
哪些進階功能讓這些函式庫與眾不同?
PDF 內容重製
內容刪節對於遵守 GDPR 和 HIPAA 等隱私權法規至關重要。
IronPDF 編輯:
using IronPdf;
// Load document containing sensitive information
PdfDocument pdf = PdfDocument.FromFile("confidential-report.pdf");
// Redact specific content across all pages
pdf.RedactTextOnAllPages("Social Security Number: [0-9]{3}-[0-9]{2}-[0-9]{4}");
pdf.RedactTextOnAllPages("Credit Card: [0-9]{4}-[0-9]{4}-[0-9]{4}-[0-9]{4}");
// Redact content on specific pages
pdf.RedactTextOnPage(2, "CONFIDENTIAL");
// Save with redactions permanently applied
pdf.SaveAs("redacted-report.pdf");
using IronPdf;
// Load document containing sensitive information
PdfDocument pdf = PdfDocument.FromFile("confidential-report.pdf");
// Redact specific content across all pages
pdf.RedactTextOnAllPages("Social Security Number: [0-9]{3}-[0-9]{2}-[0-9]{4}");
pdf.RedactTextOnAllPages("Credit Card: [0-9]{4}-[0-9]{4}-[0-9]{4}-[0-9]{4}");
// Redact content on specific pages
pdf.RedactTextOnPage(2, "CONFIDENTIAL");
// Save with redactions permanently applied
pdf.SaveAs("redacted-report.pdf");
Imports IronPdf
' Load document containing sensitive information
Private pdf As PdfDocument = PdfDocument.FromFile("confidential-report.pdf")
' Redact specific content across all pages
pdf.RedactTextOnAllPages("Social Security Number: [0-9]{3}-[0-9]{2}-[0-9]{4}")
pdf.RedactTextOnAllPages("Credit Card: [0-9]{4}-[0-9]{4}-[0-9]{4}-[0-9]{4}")
' Redact content on specific pages
pdf.RedactTextOnPage(2, "CONFIDENTIAL")
' Save with redactions permanently applied
pdf.SaveAs("redacted-report.pdf")
IronPDF 的刪除功能可永久刪除 PDF 中的內容,確保敏感資訊無法復原。 這對於法律和醫療保健行業是非常重要的。 請參閱 重製指南,瞭解更多資訊。
SelectPdf:不提供內建刪節功能,因此需要手動變通或第三方工具以符合需求。
數位簽名
IronPDF 數位簽章實作:
using IronPdf;
using IronPdf.Signing;
using System.Security.Cryptography.X509Certificates;
// Create renderer and generate PDF
ChromePdfRenderer renderer = new ChromePdfRenderer();
PdfDocument pdf = renderer.RenderHtmlAsPdf("<h1>Contract Agreement</h1>");
// Load certificate with private key
X509Certificate2 cert = new X509Certificate2("certificate.pfx", "password",
X509KeyStorageFlags.Exportable);
// Create and configure signature
var signature = new PdfSignature(cert)
{
SigningContact = "legal@company.com",
SigningLocation = "New York, NY",
SigningReason = "Contract Approval"
};
// Apply signature with timestamp
pdf.Sign(signature);
pdf.SaveAs("signed-contract.pdf");
using IronPdf;
using IronPdf.Signing;
using System.Security.Cryptography.X509Certificates;
// Create renderer and generate PDF
ChromePdfRenderer renderer = new ChromePdfRenderer();
PdfDocument pdf = renderer.RenderHtmlAsPdf("<h1>Contract Agreement</h1>");
// Load certificate with private key
X509Certificate2 cert = new X509Certificate2("certificate.pfx", "password",
X509KeyStorageFlags.Exportable);
// Create and configure signature
var signature = new PdfSignature(cert)
{
SigningContact = "legal@company.com",
SigningLocation = "New York, NY",
SigningReason = "Contract Approval"
};
// Apply signature with timestamp
pdf.Sign(signature);
pdf.SaveAs("signed-contract.pdf");
Imports IronPdf
Imports IronPdf.Signing
Imports System.Security.Cryptography.X509Certificates
' Create renderer and generate PDF
Private renderer As New ChromePdfRenderer()
Private pdf As PdfDocument = renderer.RenderHtmlAsPdf("<h1>Contract Agreement</h1>")
' Load certificate with private key
Private cert As New X509Certificate2("certificate.pfx", "password", X509KeyStorageFlags.Exportable)
' Create and configure signature
Private signature = New PdfSignature(cert) With {
.SigningContact = "legal@company.com",
.SigningLocation = "New York, NY",
.SigningReason = "Contract Approval"
}
' Apply signature with timestamp
pdf.Sign(signature)
pdf.SaveAs("signed-contract.pdf")
IronPDF 透過自動建立簽章欄位和支援時間戳伺服器簡化數位簽章。 在 數位簽名教學中探索更多內容。
SelectPdf 數位簽章:
using SelectPdf;
PdfDocument doc = new PdfDocument();
PdfPage page = doc.AddPage();
// Manual signature field setup required
string certFile = "certificate.pfx";
PdfDigitalCertificatesCollection certificates =
PdfDigitalCertificatesStore.GetCertificates(certFile, "password");
PdfDigitalCertificate certificate = certificates[0];
// Create signature element with positioning
PdfDigitalSignatureElement signature =
new PdfDigitalSignatureElement(new RectangleF(100, 100, 200, 50), certificate);
signature.Reason = "Contract Approval";
signature.ContactInfo = "legal@company.com";
signature.Location = "New York, NY";
page.Add(signature);
doc.Save("signed.pdf");
doc.Close();
using SelectPdf;
PdfDocument doc = new PdfDocument();
PdfPage page = doc.AddPage();
// Manual signature field setup required
string certFile = "certificate.pfx";
PdfDigitalCertificatesCollection certificates =
PdfDigitalCertificatesStore.GetCertificates(certFile, "password");
PdfDigitalCertificate certificate = certificates[0];
// Create signature element with positioning
PdfDigitalSignatureElement signature =
new PdfDigitalSignatureElement(new RectangleF(100, 100, 200, 50), certificate);
signature.Reason = "Contract Approval";
signature.ContactInfo = "legal@company.com";
signature.Location = "New York, NY";
page.Add(signature);
doc.Save("signed.pdf");
doc.Close();
Imports SelectPdf
Private doc As New PdfDocument()
Private page As PdfPage = doc.AddPage()
' Manual signature field setup required
Private certFile As String = "certificate.pfx"
Private certificates As PdfDigitalCertificatesCollection = PdfDigitalCertificatesStore.GetCertificates(certFile, "password")
Private certificate As PdfDigitalCertificate = certificates(0)
' Create signature element with positioning
Private signature As New PdfDigitalSignatureElement(New RectangleF(100, 100, 200, 50), certificate)
signature.Reason = "Contract Approval"
signature.ContactInfo = "legal@company.com"
signature.Location = "New York, NY"
page.Add(signature)
doc.Save("signed.pdf")
doc.Close()
SelectPdf 需要手動定位簽名欄位並進行較複雜的設定,因此不太適合自動簽署工作流程。
文件格式轉換
IronPDF DOCX 至 PDF 轉檔:
using IronPdf;
// Direct DOCX 到 PDF conversion
DocxToPdfRenderer renderer = new DocxToPdfRenderer();
// Convert with formatting preservation
PdfDocument pdf = renderer.RenderDocxAsPdf("report.docx");
// Optional: Apply post-conversion modifications
pdf.AddWatermark("<h2 style='color:red;opacity:0.5'>DRAFT</h2>");
pdf.CompressImages(90);
pdf.SaveAs("converted-report.pdf");
using IronPdf;
// Direct DOCX 到 PDF conversion
DocxToPdfRenderer renderer = new DocxToPdfRenderer();
// Convert with formatting preservation
PdfDocument pdf = renderer.RenderDocxAsPdf("report.docx");
// Optional: Apply post-conversion modifications
pdf.AddWatermark("<h2 style='color:red;opacity:0.5'>DRAFT</h2>");
pdf.CompressImages(90);
pdf.SaveAs("converted-report.pdf");
Imports IronPdf
' Direct DOCX to PDF conversion
Dim renderer As New DocxToPdfRenderer()
' Convert with formatting preservation
Dim pdf As PdfDocument = renderer.RenderDocxAsPdf("report.docx")
' Optional: Apply post-conversion modifications
pdf.AddWatermark("<h2 style='color:red;opacity:0.5'>DRAFT</h2>")
pdf.CompressImages(90)
pdf.SaveAs("converted-report.pdf")
IronPDF 的原生 DOCX 支援免除了對 Microsoft Office 的依賴。 此功能對於無法安裝 Office 的伺服器環境特別有價值。 進一步了解 DOCX 至 PDF 的轉換。
SelectPdf:不支援 DOCX 到 PDF 的轉換,限制了文件處理能力。
水印和印章
IronPDF 進階水印:
using IronPdf;
var pdf = PdfDocument.FromFile("document.pdf");
// HTML-based watermark with CSS styling
string watermarkHtml = @"
<div style='
font-size: 48px;
color: rgba(255, 0, 0, 0.3);
transform: rotate(-45deg);
text-align: center;
font-weight: bold;
'>CONFIDENTIAL</div>";
pdf.ApplyWatermark(watermarkHtml, 50, VerticalAlignment.Middle, HorizontalAlignment.Center);
// Add page numbers with custom formatting
pdf.AddHtmlFooters(new HtmlHeaderFooter
{
HtmlFragment = "<div style='text-align:center'>Page {page} of {total-pages}</div>",
DrawDividerLine = true
});
pdf.SaveAs("watermarked.pdf");
using IronPdf;
var pdf = PdfDocument.FromFile("document.pdf");
// HTML-based watermark with CSS styling
string watermarkHtml = @"
<div style='
font-size: 48px;
color: rgba(255, 0, 0, 0.3);
transform: rotate(-45deg);
text-align: center;
font-weight: bold;
'>CONFIDENTIAL</div>";
pdf.ApplyWatermark(watermarkHtml, 50, VerticalAlignment.Middle, HorizontalAlignment.Center);
// Add page numbers with custom formatting
pdf.AddHtmlFooters(new HtmlHeaderFooter
{
HtmlFragment = "<div style='text-align:center'>Page {page} of {total-pages}</div>",
DrawDividerLine = true
});
pdf.SaveAs("watermarked.pdf");
Imports IronPdf
Private pdf = PdfDocument.FromFile("document.pdf")
' HTML-based watermark with CSS styling
Private watermarkHtml As String = "
<div style='
font-size: 48px;
color: rgba(255, 0, 0, 0.3);
transform: rotate(-45deg);
text-align: center;
font-weight: bold;
'>CONFIDENTIAL</div>"
pdf.ApplyWatermark(watermarkHtml, 50, VerticalAlignment.Middle, HorizontalAlignment.Center)
' Add page numbers with custom formatting
pdf.AddHtmlFooters(New HtmlHeaderFooter With {
.HtmlFragment = "<div style='text-align:center'>Page {page} of {total-pages}</div>",
.DrawDividerLine = True
})
pdf.SaveAs("watermarked.pdf")
IronPDF 基於 HTML 的水印處理方式可利用熟悉的網路技術提供無限的客製化選項。 如需更多範例,請造訪 watermarking 指南。
每種解決方案的實際成本為何?
IronPDF 授權結構
IronPDF透明的價格為各種規模的團隊提供彈性(價格截至2025年):
-精簡版授權: $999 - 1 位開發者,1 個地點,1 個項目
- Plus 授權: $1,499 - 3 位開發者,3 個地點,3 個項目 -專業許可證: $2,999 - 10 位開發人員,10 個地點,10 個項目 -無限制許可: $5,999 - 無限制的開發者和項目
增值選項:
- 免版稅再分發:+$2,999
- 擴展支援和更新:$1,499/年
- Iron Suite :$1,498 - 可存取 9 款 Iron 軟體產品
所有授權包括
- 30 天退款保證
- 永久授權(一次性付款)
- 1 年的支援與更新
- 開發、暫存與生產使用
準備好在您的環境中評估 IronPDF 了嗎? 開始 30 天免費試用,功能完整且無水印。
SelectPdf 定價分析
- 單一開發人員: $499 - 1 個開發人員、1 個部署
- 單一開發人員 OEM: $799 - 1 位開發人員,無限制部署
- 5-開發人員: $799 - 最多 5 位開發人員、10 次部署
- 5 位開發人員 OEM: $1,099 - 最多 5 位開發人員,無限制部署部署
- 企業: $1,199 - Unlimited 開發人員,100 部署
- 企業 OEM: 1,599 美元 - 無限開發人員,無限部署
重要限制:
- 社群版只限 5 頁 PDF
- 更新需要年度維護更新
- 沒有多個產品的套件選項
- 有限退款政策
總擁有成本比較
除了初始授權之外,還要考慮這些因素:
開發時間:根據開發人員的回饋,IronPDF 直觀的 API 和廣泛的說明文件與 SelectPdf 相比,估計可減少 40-60% 的開發時間。
平台限制:SelectPdf 僅限 Windows 平台的限制,可能需要額外的基礎架構成本來進行跨平台部署。
支援成本: IronPDF 包括 24/5 工程支援,而 SelectPdf 只提供電子郵件支援,可能會增加重要問題的解決時間。
文件和支援如何比較?
IronPDF:全面的開發人員資源
IronPDF 將開發人員的成功放在首位,並提供廣泛的資源:
- 文件庫:200+篇文章涵蓋所有功能
- 程式碼範例:C# 和 VB.NET 中 100+ 可立即執行的範例
- 視訊教學:逐步視訊指南
- 應用程式介面參考:完整的類別和方法文件
- 24/5 工程支援: 直接與開發團隊接洽
- 社群論壇:活躍的開發人員社群
文件採用以任務為導向的方式,協助開發人員快速找到解決方案。 每項功能都包括工作範例、最佳實務和疑難排解指南。
SelectPdf:基本文件
SelectPdf 提供:
- 標準 API 文件
- 有限的程式碼範例
- 營業時間內的電子郵件支援
- 基本故障排除指南
根據Stack Overflow上開發人員的評論,使用者常因效能問題和進階方案的文件有限而煩惱。
真正的開發人員怎麼說?
效能回饋
Stack Overflow 討論揭示 SelectPdf 常見的問題:
- "在 .NET Core 上將 html 轉換為 pdf 只需 3 秒鐘"
- "可以對您的建立時間和部署套件大小有很大的影響
- "同樣的轉換在網路伺服器上需要大約 3.5 分鐘"
相比之下,IronPDF 用戶報告的轉換時間始終保持在亞秒級,而且資源使用效率很高。
開發人員經驗
來自 GitHub 的問題,SelectPdf 使用者注意到:
- 有限的現代 CSS 支援
- 複雜 HTML 的效能下降
- 實施後發現免費版有 5 頁限制
IronPDF 在以下方面一直受到好評:
- 直覺式 API 設計
- 優異的渲染品質
- 反應迅速的支援團隊
- 定期更新和改進
想要親身體驗其中的差異嗎? 與我們的工程團隊預約個人化的示範。
哪個函式庫能更好地處理企業需求?
合規性與安全性
IronPDF 提供企業級功能:
- 符合 GDPR 的刪除工具
- HIPAA-ready 加密
- 符合 SOC 2 Type II 規範
- 數位簽章驗證
- 稽核記錄支援
SelectPdf 提供基本的安全性,但缺乏:
- 內容刪節
- 進階簽章驗證
- 合規特定功能
- 稽核記錄功能
可擴充性及效能
企業應用程式需要一致的效能規模。 效能測試顯示:
IronPDF:
- 有效率地處理 1000 頁以上的文件
- 原生 async/await 支援,可提供高併發性
- 最佳化的記憶體管理
- 線程安全操作
選擇 PDF:
- 大型文件的效能問題
- 有限的 async 支援
- 較高的記憶體消耗
- 報告的線程限制
結論:針對您的 PDF 需求做出正確的選擇。
IronPDF 和 SelectPdf 均服務於 .NET PDF 生成市場,但它們針對不同的使用案例和開發情境。
當您需要:時,請選擇 IronPDF。
- 跨平台部署(Linux、macOS、Docker)
- 支援現代網路標準 (CSS3、JavaScript 架構)
- 進階功能(編輯、DOCX 轉換、數位簽署)
- 企業合規要求
- 專業支援與定期更新
- 雲端原生架構支援
考慮SelectPdf的用途:
- 僅限 Windows 環境
- 簡單的 HTML 至 PDF 轉換
- 具有基本要求的預算敏感型專案
- 小型文件(免費版本在 5 頁以下)
IronPDF 是功能更多更全面的解決方案,提供優異的渲染品質、豐富的功能以及真正的跨平台支援。 其現代化的架構和開發人員友善的 API 使其成為建立可擴充、可生產應用程式的團隊的理想選擇。
雖然 SelectPdf 的入門價格可能較低,但由於平台支援、功能和效能的限制,往往會增加開發時間和基礎架構的限制,導致總成本增加。
採取下一步。
準備好提升您的 PDF 生成能力了嗎? IronPDF 提供多種入門方式:
- 立即下載 IronPDF 並將其整合到您的專案中
- 探索全面的 文件庫,取得實施指南
- 開始 30 天免費試用,功能完整且無水印
- 與我們的工程團隊安排個人化的示範。
使用專為現代 .NET 開發所建立的函式庫來轉換您的 PDF 生成工作流程。 加入成千上萬已轉用 IronPDF 的開發人員行列。
!{--01001100010010010100001001010010010000010101001001011001010111110101001101010100010001010101010 10100010111110101010001010010010010010100000101001100010111110100001001001100010011111010000100100110001001111010101
常見問題解答
IronPDF 和 SelectPdf 在平台相容性上有什麼區別?
IronPDF 支援多個平台,包括 Windows、Linux、macOS 和 Docker,而 SelectPdf 僅限於 Windows 環境。這使得 IronPDF 成為需要跨平台支援專案更靈活的選擇。
IronPDF 和 SelectPdf 在 HTML 到 PDF 轉換效能上有什麼差異?
效能基準顯示,IronPDF 因其優化的記憶體管理和基於 Chrome 的渲染引擎能在不到一秒的時間內轉換頁面。相比之下,SelectPdf 尤其在處理複雜文檔時,通常每頁需時 2-3 秒。
我可以用 IronPDF 進行 DOCX 到 PDF 的轉換嗎?
可以,IronPDF 支援透過其 DocxToPdfRenderer 類進行 DOCX 到 PDF 的轉換。此功能允許您在不需要安裝 Microsoft Office 的狀況下將 Word 文檔轉換為 PDF,同時無縫地保留文檔格式。
IronPDF 如何在 HTML 到 PDF 的轉換中處理 JavaScript 和 CSS?
IronPDF 的 Chrome V8 渲染引擎完全支援 JavaScript 執行和 CSS3,有效處理現代框架如 React 和 Angular,以及像 Grid 和 Flexbox 這樣的進階 CSS 功能。
IronPDF 提供哪些 PDF 文檔的安全功能?
IronPDF 提供強大的安全功能,包括 AES-256 加密、密碼保護、數位簽名,以及透過其 SecuritySettings 類提供的詳細權限設置,提供全面的文檔保護。
IronPDF 如何協助 GDPR 和 HIPAA 合規?
IronPDF 支援內容刪減,這對 GDPR 和 HIPAA 合規至關重要。使用 RedactTextOnAllPages() 方法,您可以根據正則表達式圖樣永久刪除 PDF 中的敏感信息。
IronPDF 是否支援浮水印和印章?
有,IronPDF 允許使用 HTML/CSS 添加浮水印和印章。ApplyWatermark() 方法提供對浮水印不透明度、旋轉和定位的完全控制,讓文件品牌化變得簡單。
開發者可以期望從 IronPDF 獲得什麼樣的支援?
IronPDF 提供 24/5 的工程支援,讓您可以直接接觸開發團隊,完整的文件、超過 100 個範例代碼和視頻教程。支援渠道包括聊天和螢幕共享,用於專業許可證。
IronPDF 有試用版本嗎?
IronPDF 提供完全運作的 30 天免費試用,沒有浮水印或限制。此試用允許開發人員在生產環境中徹底評估所有功能,包括文檔和支援訪問。
IronPDF 的商業用成本如何與 SelectPdf 比較?
IronPDF 單一開發者許可證起價 $749,10 位開發者定價最高為 $2,999。相比之下,SelectPdf 針對一名開發者起價 $499。儘管 SelectPdf 的入門成本較低,但 IronPDF 提供更多功能和 24/5 的支援。

