在 ASP.NET 中創建 PDF:iTextSharp vs IronPDF
Full Comparison
Looking for a detailed feature-by-feature breakdown? See how IronPDF stacks up against Itext on pricing, HTML support, and licensing.
問題:能否使用 iTextSharp 在 ASP.NET 中建立 PDF 檔案?是否有更好的替代方案?是的——iTextSharp 是一款歷史悠久的 .NET PDF 函式庫,但 IronPDF 提供了一種現代化的 HTML 轉 PDF 方法,讓您無需學習低階的 PDF 文件結構。 本指南透過實際運作的程式碼範例,對這兩套函式庫進行比較,以便您為專案選擇合適的工具。
iTextSharp 與 IronPDF 的主要差異為何?
iTextSharp 是 Java iText 函式庫的 .NET 移植版本,可透過其文件類別提供程式化的 PDF 建立功能以及低階 PDF 內容處理功能。 雖然功能強大,但使用 iTextSharp 需要瞭解 PDF 文件結構、使用文件物件,以及使用座標和頁面大小規格來手動定位元素。 該 API 出於必要而設計得較為詳盡——此函式庫完整呈現了 PDF 規格的複雜性,這意味著在產出精緻的輸出結果之前,需要學習的內容相當多。
IronPDF 則採取不同的方法,專注於利用 Chrome 渲染引擎進行 HTML 轉 PDF。開發人員可以使用熟悉的 HTML 和 CSS 來生成 PDF 檔案,讓 PDF 的製作變得如同設計網頁般簡單直觀。 IronPDF 在後台處理 PDF 生成邏輯,讓您能夠製作具有現代化樣式且支援 JavaScript 的文件。 由於渲染管道由 Chromium 驅動,任何在現代瀏覽器中運作的版面配置都將忠實地轉譯至 PDF 輸出中——包括 flexbox、grid、網頁字型以及 JavaScript 生成的內容。
這種架構差異帶來的實際影響是:iTextSharp 適合希望對 PDF 檔案中的每個位元組進行細粒度、座標級控制的開發者;而 IronPDF 則適合希望運用現有技能快速產出視覺效果精緻文件的開發者。 對於大多數網頁應用程式情境——例如發票、報告、訂單確認及資料匯出——採用 HTML 方式建置速度更快,且更易於維護。
| 特點 | iTextSharp | IronPDF |
|---|---|---|
| HTML 到 PDF | 有限制(透過 XMLWorker 外掛程式) | 完整的 Chrome 引擎渲染 |
| CSS 支援 | 部分 | 完整支援 CSS3 |
| JavaScript 支援 | 無 | 是(透過 Chrome 引擎) |
| 許可證 | AGPL(需取得商業授權) | 商業用途,免版稅 |
| 學習曲線 | Steep(需具備 PDF API 知識) | 低(僅需 HTML/CSS 即可) |
| NuGet 安装 | Install-Package iTextSharp |
Install-Package IronPdf |
| .NET 相容性 | .NET Framework、.NET Core | .NET 8、.NET 9、.NET 10、.NET Framework |
如何在 .NET 專案中安裝這些函式庫?
安裝任一函式庫皆需透過 NuGet 套件管理員開始。 關於 iTextSharp,請注意較新的 iText 版本採用 AGPL 授權,這要求您必須將應用程式開源,或購買商業授權:
# Install iTextSharp via Package Manager Console
Install-Package iTextSharp
# Install iTextSharp via Package Manager Console
Install-Package iTextSharp
關於 IronPDF,您可以透過 NuGet 套件管理員主控台、.NET CLI,或直接在 Visual Studio 的 NuGet 介面中搜尋來安裝:
Install-Package IronPdf
安裝完成後,只需一行程式碼的 using 陳述式,即可開始使用 IronPDF。 基本 PDF 生成無需額外設定。 若需處理進階情境(例如設定授權金鑰、配置渲染選項,或在雲端環境中產生 PDF 檔案),請參閱 IronPDF 文件。 IronPDF 支援 Linux、macOS 和 Windows 部署,包括在 Docker 或 Kubernetes 中運行的容器化環境,這使其非常適合現代的雲原生 ASP.NET 應用程式。
如何使用各函式庫建立基本的 PDF 文件?
要理解這兩種 API 的差異,最直觀的方式是使用這兩套函式庫並行建立一份簡單的"Hello World"PDF 文件。
使用 iTextSharp 產生 PDF
使用 iTextSharp,您可以直接使用 Document 類別和 PdfWriter:
using iTextSharp.text;
using iTextSharp.text.pdf;
var memoryStream = new MemoryStream();
Document pdfDoc = new Document(PageSize.A4, 25, 25, 25, 15);
PdfWriter writer = PdfWriter.GetInstance(pdfDoc, memoryStream);
pdfDoc.Open();
var paragraph = new Paragraph("Hello World - PDF Document");
paragraph.Font = FontFactory.GetFont(FontFactory.HELVETICA, 16);
pdfDoc.Add(paragraph);
pdfDoc.Add(new Paragraph("Creating PDF documents with iTextSharp"));
pdfDoc.Close();
// Return as a downloadable file
var pdfBytes = memoryStream.ToArray();
using iTextSharp.text;
using iTextSharp.text.pdf;
var memoryStream = new MemoryStream();
Document pdfDoc = new Document(PageSize.A4, 25, 25, 25, 15);
PdfWriter writer = PdfWriter.GetInstance(pdfDoc, memoryStream);
pdfDoc.Open();
var paragraph = new Paragraph("Hello World - PDF Document");
paragraph.Font = FontFactory.GetFont(FontFactory.HELVETICA, 16);
pdfDoc.Add(paragraph);
pdfDoc.Add(new Paragraph("Creating PDF documents with iTextSharp"));
pdfDoc.Close();
// Return as a downloadable file
var pdfBytes = memoryStream.ToArray();
Imports iTextSharp.text
Imports iTextSharp.text.pdf
Dim memoryStream As New MemoryStream()
Dim pdfDoc As New Document(PageSize.A4, 25, 25, 25, 15)
Dim writer As PdfWriter = PdfWriter.GetInstance(pdfDoc, memoryStream)
pdfDoc.Open()
Dim paragraph As New Paragraph("Hello World - PDF Document")
paragraph.Font = FontFactory.GetFont(FontFactory.HELVETICA, 16)
pdfDoc.Add(paragraph)
pdfDoc.Add(New Paragraph("Creating PDF documents with iTextSharp"))
pdfDoc.Close()
' Return as a downloadable file
Dim pdfBytes As Byte() = memoryStream.ToArray()
這需要了解 Document、PdfWriter、Paragraph 和 FontFactory 如何互動—對於 PDF 生成新手來說,這是一項不小的學習投入。
使用 IronPDF 生成 PDF.
若使用 IronPDF,對應的任務會採用熟悉的 HTML 格式:
using IronPdf;
var renderer = new ChromePdfRenderer();
var pdf = renderer.RenderHtmlAsPdf(@"
<h1>Hello World - PDF Document</h1>
<p>Creating PDFs with IronPDF is straightforward!</p>
");
var pdfBytes = pdf.BinaryData;
using IronPdf;
var renderer = new ChromePdfRenderer();
var pdf = renderer.RenderHtmlAsPdf(@"
<h1>Hello World - PDF Document</h1>
<p>Creating PDFs with IronPDF is straightforward!</p>
");
var pdfBytes = pdf.BinaryData;
Imports IronPdf
Dim renderer As New ChromePdfRenderer()
Dim pdf = renderer.RenderHtmlAsPdf("
<h1>Hello World - PDF Document</h1>
<p>Creating PDFs with IronPDF is straightforward!</p>
")
Dim pdfBytes = pdf.BinaryData
IronPDF 的解決方案讓您能直接編寫 HTML,無需處理低階的 PDF 元素。 ChromePdfRenderer 類別透過基於 Chromium 的引擎在內部處理所有渲染作業,確保輸出結果精確至像素。
如何使用圖片和 CSS 建立具樣式的 PDF 檔案?
格式化文件揭示了這兩套函式庫之間最顯著的差異。 在生成發票、報告或品牌文件時,IronPDF 基於 CSS 的樣式設定能大幅減少所需的程式碼量。
使用 IronPDF 生成發票
using IronPdf;
var html = @"
<style>
body { font-family: Arial, sans-serif; margin: 0; }
.invoice-header { background: #4CAF50; color: white; padding: 20px; }
.invoice-table { width: 100%; border-collapse: collapse; margin-top: 20px; }
.invoice-table th, .invoice-table td {
border: 1px solid #ddd; padding: 8px; text-align: left;
}
.invoice-table th { background-color: #f2f2f2; }
.total { font-size: 18px; font-weight: bold; margin-top: 16px; }
</style>
<div class='invoice-header'>
<h1>Invoice #2024-001</h1>
<p>Due: March 15, 2024</p>
</div>
<table class='invoice-table'>
<tr><th>Item</th><th>Quantity</th><th>Unit Price</th><th>Total</th></tr>
<tr><td>PDF License</td><td>1</td><td>$599</td><td>$599</td></tr>
<tr><td>Support Package</td><td>1</td><td>$199</td><td>$199</td></tr>
</table>
<p class='total'>Grand Total: $798</p>
";
var renderer = new ChromePdfRenderer();
var pdfDocument = renderer.RenderHtmlAsPdf(html);
var pdfBytes = pdfDocument.BinaryData;
using IronPdf;
var html = @"
<style>
body { font-family: Arial, sans-serif; margin: 0; }
.invoice-header { background: #4CAF50; color: white; padding: 20px; }
.invoice-table { width: 100%; border-collapse: collapse; margin-top: 20px; }
.invoice-table th, .invoice-table td {
border: 1px solid #ddd; padding: 8px; text-align: left;
}
.invoice-table th { background-color: #f2f2f2; }
.total { font-size: 18px; font-weight: bold; margin-top: 16px; }
</style>
<div class='invoice-header'>
<h1>Invoice #2024-001</h1>
<p>Due: March 15, 2024</p>
</div>
<table class='invoice-table'>
<tr><th>Item</th><th>Quantity</th><th>Unit Price</th><th>Total</th></tr>
<tr><td>PDF License</td><td>1</td><td>$599</td><td>$599</td></tr>
<tr><td>Support Package</td><td>1</td><td>$199</td><td>$199</td></tr>
</table>
<p class='total'>Grand Total: $798</p>
";
var renderer = new ChromePdfRenderer();
var pdfDocument = renderer.RenderHtmlAsPdf(html);
var pdfBytes = pdfDocument.BinaryData;
Imports IronPdf
Dim html As String = "
<style>
body { font-family: Arial, sans-serif; margin: 0; }
.invoice-header { background: #4CAF50; color: white; padding: 20px; }
.invoice-table { width: 100%; border-collapse: collapse; margin-top: 20px; }
.invoice-table th, .invoice-table td {
border: 1px solid #ddd; padding: 8px; text-align: left;
}
.invoice-table th { background-color: #f2f2f2; }
.total { font-size: 18px; font-weight: bold; margin-top: 16px; }
</style>
<div class='invoice-header'>
<h1>Invoice #2024-001</h1>
<p>Due: March 15, 2024</p>
</div>
<table class='invoice-table'>
<tr><th>Item</th><th>Quantity</th><th>Unit Price</th><th>Total</th></tr>
<tr><td>PDF License</td><td>1</td><td>$599</td><td>$599</td></tr>
<tr><td>Support Package</td><td>1</td><td>$199</td><td>$199</td></tr>
</table>
<p class='total'>Grand Total: $798</p>
"
Dim renderer As New ChromePdfRenderer()
Dim pdfDocument = renderer.RenderHtmlAsPdf(html)
Dim pdfBytes = pdfDocument.BinaryData
使用 iTextSharp 生成發票
若要使用 iTextSharp 達成類似的輸出效果,則需透過程式設計方式建構每個視覺元素:
using iTextSharp.text;
using iTextSharp.text.pdf;
var output = new MemoryStream();
var document = new Document(PageSize.A4);
PdfWriter.GetInstance(document, output);
document.Open();
// Header -- manual font and color setup
var titleFont = FontFactory.GetFont(FontFactory.HELVETICA_BOLD, 20,
new BaseColor(255, 255, 255));
var headerParagraph = new Paragraph("Invoice #2024-001", titleFont);
document.Add(headerParagraph);
// Table -- each cell must be created individually
PdfPTable table = new PdfPTable(4);
table.WidthPercentage = 100;
string[] headers = { "Item", "Quantity", "Unit Price", "Total" };
foreach (var h in headers)
{
var cell = new PdfPCell(new Phrase(h,
FontFactory.GetFont(FontFactory.HELVETICA_BOLD, 10)));
cell.BackgroundColor = new BaseColor(242, 242, 242);
table.AddCell(cell);
}
table.AddCell("PDF License");
table.AddCell("1");
table.AddCell("$599");
table.AddCell("$599");
document.Add(table);
var totalFont = FontFactory.GetFont(FontFactory.HELVETICA_BOLD, 14);
document.Add(new Paragraph("Grand Total: $798", totalFont));
document.Close();
using iTextSharp.text;
using iTextSharp.text.pdf;
var output = new MemoryStream();
var document = new Document(PageSize.A4);
PdfWriter.GetInstance(document, output);
document.Open();
// Header -- manual font and color setup
var titleFont = FontFactory.GetFont(FontFactory.HELVETICA_BOLD, 20,
new BaseColor(255, 255, 255));
var headerParagraph = new Paragraph("Invoice #2024-001", titleFont);
document.Add(headerParagraph);
// Table -- each cell must be created individually
PdfPTable table = new PdfPTable(4);
table.WidthPercentage = 100;
string[] headers = { "Item", "Quantity", "Unit Price", "Total" };
foreach (var h in headers)
{
var cell = new PdfPCell(new Phrase(h,
FontFactory.GetFont(FontFactory.HELVETICA_BOLD, 10)));
cell.BackgroundColor = new BaseColor(242, 242, 242);
table.AddCell(cell);
}
table.AddCell("PDF License");
table.AddCell("1");
table.AddCell("$599");
table.AddCell("$599");
document.Add(table);
var totalFont = FontFactory.GetFont(FontFactory.HELVETICA_BOLD, 14);
document.Add(new Paragraph("Grand Total: $798", totalFont));
document.Close();
Imports iTextSharp.text
Imports iTextSharp.text.pdf
Dim output As New MemoryStream()
Dim document As New Document(PageSize.A4)
PdfWriter.GetInstance(document, output)
document.Open()
' Header -- manual font and color setup
Dim titleFont As Font = FontFactory.GetFont(FontFactory.HELVETICA_BOLD, 20, New BaseColor(255, 255, 255))
Dim headerParagraph As New Paragraph("Invoice #2024-001", titleFont)
document.Add(headerParagraph)
' Table -- each cell must be created individually
Dim table As New PdfPTable(4)
table.WidthPercentage = 100
Dim headers As String() = {"Item", "Quantity", "Unit Price", "Total"}
For Each h As String In headers
Dim cell As New PdfPCell(New Phrase(h, FontFactory.GetFont(FontFactory.HELVETICA_BOLD, 10)))
cell.BackgroundColor = New BaseColor(242, 242, 242)
table.AddCell(cell)
Next
table.AddCell("PDF License")
table.AddCell("1")
table.AddCell("$599")
table.AddCell("$599")
document.Add(table)
Dim totalFont As Font = FontFactory.GetFont(FontFactory.HELVETICA_BOLD, 14)
document.Add(New Paragraph("Grand Total: $798", totalFont))
document.Close()
兩者的差異顯而易見:IronPDF 能處理 CSS、現代 HTML 及 JavaScript,而 iTextSharp 則需要手動建立每個元素、指定字型,並逐格構建表格。 對於需要生成數十種不同範本的文件密集型應用程式而言,這種程式碼量的差異會隨著時間推移而顯著累積。
如何在 ASP.NET 中處理伺服器端的 PDF 生成?
這兩套函式庫均支援為 ASP.NET 應用程式進行伺服器端的 PDF 生成。 無論使用哪個函式庫產生位元組,將 PDF 作為可下載檔案回應的模式皆大致相同。 在實際應用中,關鍵考量因素包括記憶體管理、執行緒安全性以及回應設定。 這兩套函式庫皆使用記憶體內流,因此請確保您不會將大型 PDF 檔案保留在記憶體中超過必要時間。 IronPDF 的 ChromePdfRenderer 設計為每個請求實例化,因此無需擔心並發請求之間的共享狀態。
使用 IronPDF 的 ASP.NET Core 控制器動作
using IronPdf;
using Microsoft.AspNetCore.Mvc;
[ApiController]
[Route("api/[controller]")]
public class PdfController : ControllerBase
{
[HttpGet("invoice/{id}")]
public IActionResult GenerateInvoice(int id)
{
var html = BuildInvoiceHtml(id); // your HTML template
var renderer = new ChromePdfRenderer();
renderer.RenderingOptions.PaperSize = IronPdf.Rendering.PdfPaperSize.A4;
renderer.RenderingOptions.MarginTop = 20;
renderer.RenderingOptions.MarginBottom = 20;
var pdf = renderer.RenderHtmlAsPdf(html);
return File(pdf.BinaryData, "application/pdf", $"invoice-{id}.pdf");
}
private static string BuildInvoiceHtml(int id)
{
return $"<h1>Invoice #{id}</h1><p>Generated on {DateTime.UtcNow:yyyy-MM-dd}</p>";
}
}
using IronPdf;
using Microsoft.AspNetCore.Mvc;
[ApiController]
[Route("api/[controller]")]
public class PdfController : ControllerBase
{
[HttpGet("invoice/{id}")]
public IActionResult GenerateInvoice(int id)
{
var html = BuildInvoiceHtml(id); // your HTML template
var renderer = new ChromePdfRenderer();
renderer.RenderingOptions.PaperSize = IronPdf.Rendering.PdfPaperSize.A4;
renderer.RenderingOptions.MarginTop = 20;
renderer.RenderingOptions.MarginBottom = 20;
var pdf = renderer.RenderHtmlAsPdf(html);
return File(pdf.BinaryData, "application/pdf", $"invoice-{id}.pdf");
}
private static string BuildInvoiceHtml(int id)
{
return $"<h1>Invoice #{id}</h1><p>Generated on {DateTime.UtcNow:yyyy-MM-dd}</p>";
}
}
Imports IronPdf
Imports Microsoft.AspNetCore.Mvc
<ApiController>
<Route("api/[controller]")>
Public Class PdfController
Inherits ControllerBase
<HttpGet("invoice/{id}")>
Public Function GenerateInvoice(id As Integer) As IActionResult
Dim html As String = BuildInvoiceHtml(id) ' your HTML template
Dim renderer As New ChromePdfRenderer()
renderer.RenderingOptions.PaperSize = IronPdf.Rendering.PdfPaperSize.A4
renderer.RenderingOptions.MarginTop = 20
renderer.RenderingOptions.MarginBottom = 20
Dim pdf = renderer.RenderHtmlAsPdf(html)
Return File(pdf.BinaryData, "application/pdf", $"invoice-{id}.pdf")
End Function
Private Shared Function BuildInvoiceHtml(id As Integer) As String
Return $"<h1>Invoice #{id}</h1><p>Generated on {DateTime.UtcNow:yyyy-MM-dd}</p>"
End Function
End Class
對於 ASP.NET MVC(非核心)項目,以相同的方式傳回 FileResult。 IronPDF 亦支援透過 URL 產生 PDF 檔案,這對於轉換現有網頁(而非構建 HTML 字串)時特別有用。
您亦可透過 IronPDF 的文件編輯 API 添加頁首與頁尾、套用數位簽章、設定密碼保護,或合併多個 PDF 檔案——所有功能皆整合於同一個套件中。
如何從 iTextSharp 遷移至 IronPDF?
將現有的 iTextSharp 專案遷移至 IronPDF 遵循以下簡單步驟:
1.將文件模型程式碼替換為 HTML 範本。無需建置 Paragraph、PdfPTable 和 PdfPCell 對象,而是建立 HTML 字串或載入 HTML 檔案。您可以直接重複使用現有的 CSS 樣式表和 Razor 局部視圖。
2.交換渲染調用。將 PdfWriter.GetInstance(doc, stream) 替換為 new ChromePdfRenderer().RenderHtmlAsPdf(html)。
3.更新位元組提取。將 memoryStream.ToArray() 替換為 pdf.BinaryData。
4.傳輸進階設定。 iTextSharp的頁邊距、加密和文件元資料等功能在 IronPDF 的 RenderingOptions 和 PdfDocument API 中有直接對應的功能。
- 驗證輸出準確性。請將兩種輸出結果並列顯示於具代表性的文件上進行比對。 IronPDF 通常能產生更佳的視覺效果,因為它採用完整的瀏覽器渲染引擎,而非 PDF 原生的版面配置引擎。
對於已擁有現成 HTML 範本(來自電子郵件生成器、Razor 檢視或報表 Builder)的團隊,遷移作業通常只需數小時即可完成,而非數天。 IronPDF 可在 ASP.NET Core 環境中直接將 Razor 檢視渲染為 PDF,進一步加速遷移流程。 對於已投入 CSS 文件設計的團隊——例如使用 PRINT 樣式表來控制分頁與邊距——會發現這些技能可直接應用於 IronPDF。
請參閱 IronPDF 遷移指南,其中包含關於加密、加蓋水印及其他 iTextSharp 進階功能的詳細範例。
您應該選擇哪一個程式庫?
對於正在啟動新專案或從 iTextSharp 遷移過來的開發人員,請注意以下因素:
授權條款:iTextSharp 的新版本採用 AGPL 授權,這意味著您必須將應用程式開源,或向 iText Group 購買商業授權。IronPDF 則提供簡明的商業授權方案,無需履行開源義務。 若您的專案屬閉源或商業性質,僅此區別便可能決定您的選擇。
學習曲線:IronPDF 採用基於 HTML 的方法,意味著您無需花費太多時間學習 PDF 專用的 API。若您的團隊熟悉 HTML 和 CSS,即可立即開始使用 IronPDF 生成 PDF。 您無需研究 PDF 座標系統、字元編碼或字型嵌入——IronPDF 會透明地處理所有這些事項。
功能涵蓋:IronPDF 支援 PDF/A 標準、表單填寫、浮水印等功能——所有功能皆整合於單一 NuGet 套件中。 此外,還包含數位簽章和 PDF 合併等進階功能,且無需額外依賴項。
遷移路徑:從 iTextSharp 遷移至 IronPDF 需將文件處理程式碼替換為 HTML 範本,並更新渲染呼叫。 由於 IronPDF 採用完整的瀏覽器引擎,產出的程式碼通常品質更高,且顯著更簡潔、更易於維護。
關於 PDF 渲染引擎的工作原理及其差異,Mozilla 的 PDF 文件及 Adobe 的 PDF 規格資源可提供有用的背景資訊。 iText Group 官方網站詳細說明了 AGPL 條款。
下一步計劃是什麼?
要在您的 ASP.NET 專案中開始使用 IronPDF:
- 安裝 NuGet 套件:
Install-Package IronPdf - 將
using IronPdf;新增至您的檔案中 - 建立一個
ChromePdfRenderer,並使用您的 HTML 呼叫RenderHtmlAsPdf()。 - 從控制器返回
pdf.BinaryData作為FileResult
探索以下資源,了解更多:
- IronPDF HTML 轉 PDF 文件 -- 完整的渲染選項與範例
- ASP.NET Core PDF 生成指南 -- Razor 檢視渲染與控制器模式
- PDF 安全性與加密 -- 密碼保護與權限設定
- PDF 合併與分割 -- 結合多個文件
- IronPDF 免費試用版 -- 開發期間可測試所有功能,且無浮水印
常見問題
iTextSharp 和 IronPDF 在 ASP.NET PDF 產生的主要差異是什麼?
主要差異包括易用性、授權模式和渲染方針。IronPDF 使用由 Chrome 引擎支持的 HTML 到 PDF 模型,使生成樣式化文檔變得簡單。iTextSharp 使用低級 PDF 文檔 API,需要學習 PDF 特定的結構。IronPDF 還使用無開源義務的商業授權,而 iTextSharp 的新版本則使用 AGPL。
IronPDF能否在ASP.NET應用程式中將HTML轉換為PDF?
是的,IronPDF 可以在 ASP.NET 應用程式中將 HTML 轉換為 PDF。它允許開發者使用 Chromium 為基礎的渲染引擎將網頁、HTML 字串或 HTML 檔案直接渲染為 PDF,高度忠實。
可以從 iTextSharp 切換到 IronPDF 嗎?
是的,從 iTextSharp 切換到 IronPDF 非常簡單。遷移涉及用 HTML 模板替換文檔模型代碼並更新渲染調用。擁有現有 HTML 或 Razor 模板的團隊通常可以在幾小時內完成遷移。
IronPDF 是否支援從 ASP.NET Web 應用程式產生 PDF?
IronPDF 完全支援從 ASP.NET 和 ASP.NET Core 網頁應用程式生成 PDF。它通過 NuGet 整合到現有項目中,並支援用於返回 PDF 文件的控制器操作模式。
可使用 IronPDF 創建哪類型文檔?
使用 IronPDF,您可以創建發票、報告、數據匯出以及任何可表現為 HTML 的文件。它支援 PDF/A 合規性、表單填寫、數位簽名、水印和條碼生成。
IronPDF 和 iTextSharp 在許可方面有何不同?
IronPDF 提供無 AGPL 義務的商業授權,使其適合用於閉源應用程式。iTextSharp 的新版本使用 AGPL,這需要為專有軟體獲取商業授權。
是否有在 ASP.NET 中使用 IronPDF 的程式碼範例?
是的,IronPDF 提供大量代碼範例和文檔,包括 HTML 到 PDF 轉換、URL 渲染、ASP.NET Core 控制器模式以及進階功能如頁眉、頁腳和數位簽名。
為什麼考慮使用 IronPDF 而不是 iTextSharp?
您應考慮使用 IronPDF,如果您希望使用 HTML 和 CSS 生成樣式化文檔,避免 iTextSharp 新版本的 AGPL 授權要求,或者減少您的團隊需要維護的 PDF 特定代碼量。
IronPDF 能夠在雲端和容器化環境中運作嗎?
是的,IronPDF 支援 Linux、macOS 和 Windows 部署,包括 Docker 和 Kubernetes 容器化環境,使其適合現代雲原生 ASP.NET 應用程式。
IronPDF 是否適用於企業級 ASP.NET 專案?
是的,IronPDF 適用於企業級 ASP.NET 專案。它提供可靠的性能、PDF/A 合規性、數位簽名支援,並且在大批量文檔生成場景中具有可擴展性。

