如何在 C# 中從 IronPdfium 遷移到 IronPDF
從 IronPdf 遷移到 IronPDF:完整的 C# 遷移指南。
從 IronPdf for .NET 轉換到 IronPDF,可將您的 .NET PDF 工作流程從一個以渲染為重點、具有本機二進位相依性的函式庫,轉換為一個全面的 PDF 解決方案,可處理建立、操作和渲染,而無需特定平台的複雜性。 本指南提供完整的逐步遷移路徑,可消除本機相依性管理,同時增加 Pdfium 無法提供的功能。
為何要從 IronPdf 轉移到 IronPDF?
瞭解 Pdfium.NET
Pdfium.NET 是 Google PDFium 函式庫的 .NET wrapper,該函式庫以其渲染 PDF 文件的效率和速度而聞名。 對於鑽研 C# 應用程式中複雜的 PDF 渲染的開發人員而言,它已經成為一個重要的函式庫,可在 .NET 環境中提供 PDF 內容的高保真複製。
然而,儘管 Pdfium.NET 在渲染方面表現優異,但其建立和處理 PDF 文件的能力卻相當有限。 它主要是針對需要準確顯示 PDF 內容的應用程式而建立,較少強調修改或建立新的 PDF。
關鍵字限制
1.Rendering-Only Focus:無法從 HTML、圖片或程式化方式建立 PDF。 Pdfium 的功能僅限於檢視與渲染 PDF。
2.無 PDF 操作:無法合併、分割或修改 PDF 內容。 本機不支援 PDF 合併,您需要使用 iTextSharp 或 PdfSharp 等其他函式庫。
3.原生二進位相依性:需要特定平台的 PDFium 二進位檔。 開發人員需要管理原生的 PDFium 二進位檔,這方面增加了部署和發行過程中的複雜性。
4.部署複雜性:必須以 x86、x64 和 runtimes 資料夾束縛和管理每個平台的本機 DLL。
5.有限文字萃取:不含格式化的基本文字萃取。 文字萃取需要使用 Pdfium.NET 進行額外的工作。
6.無法將 HTML 轉換為 PDF:無法將網頁內容轉換為 PDF。 Pdfium.NET 不支援 HTML 至 PDF 的轉換。
7.無標題/頁腳:不能添加頁碼或重複內容。
8.無水印:無法在文件上蓋上覆蓋圖章。
9.無表格支援:無法填寫或讀取 PDF 表單。
10.無安全功能:無法加密或以密碼保護 PDF。
Pdfium vsIronPDF比較
| 範疇 | Pdfium.NET | IronPDF |
|---|---|---|
| 主要焦點 | 渲染/檢視 | 完整的 PDF 解決方案 |
| 渲染保真度 | 高保真渲染 | 高,尤其是 HTML/CSS/JS。 |
| PDF製作 | ✗ | ✓(HTML、URL、圖片) |
| PDF 操作 | ✗ | ✓(合併、分割、編輯) |
| HTML至PDF | ✗ | ✓(Chromium 引擎) |
| 水印。 | ✗ | ✓ |
| 頁首/頁腳 | ✗ | ✓ |
| 表格填寫 | ✗ | ✓ |
| 安全性 | ✗ | ✓ |
| 本機依賴性 | 要求 | 無(完全管理) |
| 跨平台 | 複雜的設定 | 自動化 |
| 易於部署 | 因本機依賴性而變得複雜 | 更輕鬆; 減少依賴複雜性 |
對於計劃在 2025 年和 2026 年之前採用 .NET 10 和 C# 14 的團隊而言,IronPDF 提供了一個完全可管理的基礎,可省去本機二進位管理,同時增加全面的 PDF 建立和操作功能。
開始之前
先決條件
1..NET 環境:.NET Framework 4.6.2+ 或 .NET Core 3.1+ / .NET 5/6/7/8/9+ 2.NuGet存取:安裝 NuGet 套件的能力 3.IronPDF 授權:從IronPdf.com取得您的授權金鑰。
NuGet 套件變更
# Remove Pdfium packages
dotnet remove package Pdfium.NET
dotnet remove package Pdfium.Net.SDK
dotnet remove package PdfiumViewer
# Install IronPDF
dotnet add package IronPdf# Remove Pdfium packages
dotnet remove package Pdfium.NET
dotnet remove package Pdfium.Net.SDK
dotnet remove package PdfiumViewer
# Install IronPDF
dotnet add package IronPdf授權組態
// Add at application startup (Program.cs or Startup.cs)
IronPdf.License.LicenseKey = "YOUR-LICENSE-KEY";// Add at application startup (Program.cs or Startup.cs)
IronPdf.License.LicenseKey = "YOUR-LICENSE-KEY";IRON VB CONVERTER ERROR developers@ironsoftware.com辨識 Pdfium 使用方式
# Find Pdfium usage
grep -r "Pdfium\|PdfDocument\.Load\|\.Render\(" --include="*.cs" .
# Find native binary references
grep -r "pdfium\.dll\|pdfium\.so\|pdfium\.dylib" --include="*.csproj" --include="*.config" .
# Find platform-specific code
grep -r "#if.*64\|WIN32\|WIN64\|LINUX\|OSX" --include="*.cs" .# Find Pdfium usage
grep -r "Pdfium\|PdfDocument\.Load\|\.Render\(" --include="*.cs" .
# Find native binary references
grep -r "pdfium\.dll\|pdfium\.so\|pdfium\.dylib" --include="*.csproj" --include="*.config" .
# Find platform-specific code
grep -r "#if.*64\|WIN32\|WIN64\|LINUX\|OSX" --include="*.cs" .完整的 API 參考資料
命名空間變更
// Pdfium.NET
using Pdfium;
using Pdfium.Net;
using PdfiumViewer;
// IronPDF
using IronPdf;
using IronPdf.Rendering;
using IronPdf.Editing;// Pdfium.NET
using Pdfium;
using Pdfium.Net;
using PdfiumViewer;
// IronPDF
using IronPdf;
using IronPdf.Rendering;
using IronPdf.Editing;IRON VB CONVERTER ERROR developers@ironsoftware.com核心類對應
| Pdfium.NET | IronPDF | 筆記 |
|---|---|---|
| <編碼>PDF 文件</編碼 | <編碼>PDF 文件</編碼 | 相同的名稱,不同的功能 |
PdfPage | PdfPage | 類似介面 |
| <編碼>PdfPageCollection</編碼 | <編碼>PdfPageCollection</編碼 | 類似介面 |
| (不可用) | <代碼>ChromePdfRenderer</代碼 | PDF 建立 |
| (不可用) | <編碼>HtmlHeaderFooter</編碼 | 標題/頁腳 |
文件載入映射
| Pdfium.NET | IronPDF | 筆記 |
|---|---|---|
| <代碼>PdfDocument.Load(path)</代碼 | PdfDocument.FromFile(path) | 從檔案載入 |
| <代碼>PdfDocument.Load(stream)</代碼 | PdfDocument.FromStream(stream) | 從串流載入 |
| <代碼>PdfDocument.Load(bytes)</代碼 | <代碼>PdfDocument.FromBinaryData(bytes)</代碼 | 從字節載入 |
new PdfDocument(path)。 | PdfDocument.FromFile(path) | 構成模式 |
文件屬性對應
| Pdfium.NET | IronPDF | 筆記 |
|---|---|---|
| <編碼>document.PageCount</編碼 | <編碼>document.PageCount</編碼 | 內容相同 |
| <編碼>document.Pages</編碼 | <編碼>document.Pages</編碼 | 類似作品集 |
| <編碼>document.Pages[index]</編碼 | <編碼>document.Pages[index]</編碼 | 零基礎 |
document.GetPageSize(index) | <編碼>document.Pages[index].寬度/高度</編碼 | 直接屬性 |
文字萃取對應
| Pdfium.NET | IronPDF | 筆記 |
|---|---|---|
document.GetPdfText(pageIndex)。 | <編碼>document.Pages[index].Text</編碼 | 每頁 |
| (手動迴圈) | <編碼>document.ExtractAllText()</編碼 | 一次完成所有頁面 |
| <編碼>page.GetTextBounds()</編碼 | page.Text | 簡化 |
儲存文件映射
| Pdfium.NET | IronPDF | 筆記 |
|---|---|---|
| <編碼>document.Save(路徑)</編碼 | <編碼>document.SaveAs(路徑)</編碼 | 不同的方法名稱 |
document.Save(stream)。 | document.Stream | 存取流 |
| (不可用) | <編碼>document.BinaryData</編碼 | 取得 bytes |
頁面渲染對應
| Pdfium.NET | IronPDF | 筆記 |
|---|---|---|
page.Render(寬度、高度)。 | <代碼>pdf.RasterizeToImageFiles(路徑, dpi)</ 代碼 | 光柵化 |
page.Render(width, height, flags) 頁面渲染(寬度、高度、旗標) | DPI 參數 | 品質控制 |
document.Render(index,width,height)。 | <代碼>pdf.RasterizeToImageFiles()</代碼 | 批量渲染 |
page.RenderToScale(scale)。 | DPI:72*比例尺 | 比例轉換為 DPI |
Pdfium 中沒有的新功能
| IronPdf 特點 | 說明 |
|---|---|
| <代碼>ChromePdfRenderer.RenderHtmlAsPdf()</代碼 | 從 HTML 建立 |
| <代碼>ChromePdfRenderer.RenderUrlAsPdf()</代碼 | 從 URL 建立 |
| <代碼>ChromePdfRenderer.RenderHtmlFileAsPdf()</代碼 | 從 HTML 檔案建立 |
| <代碼>PdfDocument.Merge()</代碼 | 結合 PDF |
| <代碼>pdf.CopyPages()</代碼 | 摘錄頁面 |
| <代碼>pdf.RemovePages()</代碼 | 刪除頁面 |
| <代碼>pdf.InsertPdf()</代碼 | 在位置插入 PDF |
| <代碼>pdf.ApplyWatermark()</代碼 | 加入水印 |
| <代碼>pdf.AddHtmlHeaders()</代碼 | 新增標頭 |
| <代碼>pdf.AddHtmlFooters()</代碼 | 新增頁腳 |
| <編碼>pdf.SecuritySettings</編碼 | 密碼保護 |
| <代碼>pdf.SignWithDigitalSignature()</代碼 | 數位簽名 |
| <代碼>pdf.Form</代碼 | 表格填寫 |
程式碼遷移範例
範例 1:從 PDF 擷取文字
之前 (Pdfium):
// NuGet: Install-Package PdfiumViewer
using PdfiumViewer;
using System;
using System.IO;
using System.Text;
class Program
{
static void Main()
{
string pdfPath = "document.pdf";
using (var document = PdfDocument.Load(pdfPath))
{
StringBuilder text = new StringBuilder();
for (int i = 0; i < document.PageCount; i++)
{
// Note: PdfiumViewer has limited text extraction capabilities
// Text extraction requires additional work with Pdfium.NET
string pageText = document.GetPdfText(i);
text.AppendLine(pageText);
}
Console.WriteLine(text.ToString());
}
}
}// NuGet: Install-Package PdfiumViewer
using PdfiumViewer;
using System;
using System.IO;
using System.Text;
class Program
{
static void Main()
{
string pdfPath = "document.pdf";
using (var document = PdfDocument.Load(pdfPath))
{
StringBuilder text = new StringBuilder();
for (int i = 0; i < document.PageCount; i++)
{
// Note: PdfiumViewer has limited text extraction capabilities
// Text extraction requires additional work with Pdfium.NET
string pageText = document.GetPdfText(i);
text.AppendLine(pageText);
}
Console.WriteLine(text.ToString());
}
}
}IRON VB CONVERTER ERROR developers@ironsoftware.comAfter (IronPDF):
// NuGet: Install-Package IronPdf
using IronPdf;
using System;
class Program
{
static void Main()
{
string pdfPath = "document.pdf";
var pdf = PdfDocument.FromFile(pdfPath);
string text = pdf.ExtractAllText();
Console.WriteLine(text);
}
}// NuGet: Install-Package IronPdf
using IronPdf;
using System;
class Program
{
static void Main()
{
string pdfPath = "document.pdf";
var pdf = PdfDocument.FromFile(pdfPath);
string text = pdf.ExtractAllText();
Console.WriteLine(text);
}
}IRON VB CONVERTER ERROR developers@ironsoftware.com這裡的差異非常大。 Pdfium 需要使用 GetPdfText(pageIndex) 手動迴圈每一頁,建立 StringBuilder 並管理 using 語句以妥善處理。 程式碼指出,"PdfiumViewer 的文字萃取功能有限","文字萃取需要額外的工作"。
IronPDF 將此簡化為三行:使用 PdfDocument.FromFile() 載入,使用 ExtractAllText() 擷取,以及輸出。 ExtractAllText() 方法可自動處理所有頁面,並具備更先進的文字萃取功能。 如果您需要按頁提取,您可以使用 pdf.Pages[index].Text. 請參閱 文字萃取文件,以瞭解其他選項。
範例 2:PDF 合併
之前 (Pdfium):
// NuGet: Install-Package PdfiumViewer
using PdfiumViewer;
using System;
using System.IO;
using System.Collections.Generic;
// Note: PdfiumViewer does not have native PDF merging functionality
// You would need to use additional libraries or implement custom logic
class Program
{
static void Main()
{
List<string> pdfFiles = new List<string>
{
"document1.pdf",
"document2.pdf",
"document3.pdf"
};
// PdfiumViewer is primarily for rendering/viewing
// PDF merging is not natively supported
// You would need to use another library like iTextSharp or PdfSharp
Console.WriteLine("PDF merging not natively supported in PdfiumViewer");
}
}// NuGet: Install-Package PdfiumViewer
using PdfiumViewer;
using System;
using System.IO;
using System.Collections.Generic;
// Note: PdfiumViewer does not have native PDF merging functionality
// You would need to use additional libraries or implement custom logic
class Program
{
static void Main()
{
List<string> pdfFiles = new List<string>
{
"document1.pdf",
"document2.pdf",
"document3.pdf"
};
// PdfiumViewer is primarily for rendering/viewing
// PDF merging is not natively supported
// You would need to use another library like iTextSharp or PdfSharp
Console.WriteLine("PDF merging not natively supported in PdfiumViewer");
}
}IRON VB CONVERTER ERROR developers@ironsoftware.comAfter (IronPDF):
// NuGet: Install-Package IronPdf
using IronPdf;
using System;
using System.Collections.Generic;
class Program
{
static void Main()
{
List<string> pdfFiles = new List<string>
{
"document1.pdf",
"document2.pdf",
"document3.pdf"
};
var pdf = PdfDocument.Merge(pdfFiles);
pdf.SaveAs("merged.pdf");
Console.WriteLine("PDFs merged successfully");
}
}// NuGet: Install-Package IronPdf
using IronPdf;
using System;
using System.Collections.Generic;
class Program
{
static void Main()
{
List<string> pdfFiles = new List<string>
{
"document1.pdf",
"document2.pdf",
"document3.pdf"
};
var pdf = PdfDocument.Merge(pdfFiles);
pdf.SaveAs("merged.pdf");
Console.WriteLine("PDFs merged successfully");
}
}IRON VB CONVERTER ERROR developers@ironsoftware.com這個範例突顯了一個基本的能力缺口。Pdfium 不能合併 PDF--程式碼明確指出"PdfiumViewer 並不支援 PDF 合併"以及"您需要使用其他函式庫,例如 iTextSharp 或 PdfSharp"。
IronPDF 提供本機合併功能,靜態<代碼>PdfDocument.Merge()</代碼方法可直接接受檔案路徑清單。 結果是您使用 SaveAs() 儲存的新<編碼>PDF 文件</編碼。 進一步瞭解 合併與分割 PDF 的相關資訊。
範例 3:HTML 到 PDF 的轉換
之前 (Pdfium):
// NuGet: Install-Package PdfiumViewer
using PdfiumViewer;
using System.IO;
using System.Drawing.Printing;
// Note: PdfiumViewer is primarily for viewing/rendering PDFs, not creating them from HTML
// For HTML to PDF with Pdfium.NET, you would need additional libraries
// This example shows a limitation of Pdfium.NET
class Program
{
static void Main()
{
// Pdfium.NET does not have native HTML to PDF conversion
// You would need to use a separate library to convert HTML to PDF
// then use Pdfium for manipulation
string htmlContent = "<h1>Hello World</h1>";
// This functionality is not directly available in Pdfium.NET
Console.WriteLine("HTML to PDF conversion not natively supported in Pdfium.NET");
}
}// NuGet: Install-Package PdfiumViewer
using PdfiumViewer;
using System.IO;
using System.Drawing.Printing;
// Note: PdfiumViewer is primarily for viewing/rendering PDFs, not creating them from HTML
// For HTML to PDF with Pdfium.NET, you would need additional libraries
// This example shows a limitation of Pdfium.NET
class Program
{
static void Main()
{
// Pdfium.NET does not have native HTML to PDF conversion
// You would need to use a separate library to convert HTML to PDF
// then use Pdfium for manipulation
string htmlContent = "<h1>Hello World</h1>";
// This functionality is not directly available in Pdfium.NET
Console.WriteLine("HTML to PDF conversion not natively supported in Pdfium.NET");
}
}IRON VB CONVERTER ERROR developers@ironsoftware.comAfter (IronPDF):
// NuGet: Install-Package IronPdf
using IronPdf;
using System;
class Program
{
static void Main()
{
var renderer = new ChromePdfRenderer();
string htmlContent = "<h1>Hello World</h1>";
var pdf = renderer.RenderHtmlAsPdf(htmlContent);
pdf.SaveAs("output.pdf");
Console.WriteLine("PDF created successfully");
}
}// NuGet: Install-Package IronPdf
using IronPdf;
using System;
class Program
{
static void Main()
{
var renderer = new ChromePdfRenderer();
string htmlContent = "<h1>Hello World</h1>";
var pdf = renderer.RenderHtmlAsPdf(htmlContent);
pdf.SaveAs("output.pdf");
Console.WriteLine("PDF created successfully");
}
}IRON VB CONVERTER ERROR developers@ironsoftware.com本範例展示了最顯著的能力差異。 Pdfium 明確指出:"Pdfium.NET 不支援 HTML 至 PDF 的轉換",以及 "您需要使用單獨的函式庫來轉換 HTML 至 PDF"。
IronPDF 透過<代碼>ChromePdfRenderer</代碼提供原生 HTML 至 PDF 的轉換,其內部使用 Chromium 引擎來精確呈現 HTML、CSS 和 JavaScript。 RenderHtmlAsPdf() 方法可將 HTML 字串直接轉換為 PDF 文件。IronPDF也可以使用 RenderUrlAsPdf() 渲染 URL,以及使用 RenderHtmlFileAsPdf() 渲染 HTML 檔案。 請參閱 HTML to PDF 文件,以瞭解全面的範例。
原生依賴移除
從 IronPdf 遷移到IronPDF最顯著的好處之一,就是省去原生二進位管理。
之前 (Pdfium) - 複雜部署
MyApp/
├── bin/
│ ├── MyApp.dll
│ ├── Pdfium.NET.dll
│ ├── x86/
│ │ └── pdfium.dll
│ └── x64/
│ └── pdfium.dll
├──運行時間/
│ ├─── Win-x86/native/
│ │ └── pdfium.dll
│ └─── Win-x64/native/
│ └── pdfium.dllAfter (IronPDF) - 乾淨部署。
MyApp/
├── bin/
│ ├── MyApp.dll
│ └─── IronPdf.dll # 包含的所有內容移除原生二進位引用
# Delete native PDFium binaries
rm -rf x86/ x64/ runtimes/
# Remove from .csproj
# Delete any <Content Include="pdfium.dll" /> entries
# Delete any <None Include="x86/pdfium.dll" /> entries# Delete native PDFium binaries
rm -rf x86/ x64/ runtimes/
# Remove from .csproj
# Delete any <Content Include="pdfium.dll" /> entries
# Delete any <None Include="x86/pdfium.dll" /> entries關鍵遷移注意事項
縮放至 DPI 轉換
Pdfium 使用比例係數; IronPdf 使用 DPI:
// Formula:IronPDFDPI = 72 × Pdfium scale
// Pdfium scale 2.0 →IronPDFDPI 144
pdf.RasterizeToImageFiles("*.png", DPI: 144);// Formula:IronPDFDPI = 72 × Pdfium scale
// Pdfium scale 2.0 →IronPDFDPI 144
pdf.RasterizeToImageFiles("*.png", DPI: 144);IRON VB CONVERTER ERROR developers@ironsoftware.com文件載入方法變更
// Pdfium
PdfDocument.Load(path)
// IronPDF
PdfDocument.FromFile(path)// Pdfium
PdfDocument.Load(path)
// IronPDF
PdfDocument.FromFile(path)IRON VB CONVERTER ERROR developers@ironsoftware.com儲存方法變更
// Pdfium
document.Save(path)
// IronPDF
pdf.SaveAs(path)// Pdfium
document.Save(path)
// IronPDF
pdf.SaveAs(path)IRON VB CONVERTER ERROR developers@ironsoftware.com處理模式簡化
// Pdfium:要求explicit disposal
using (var document = PdfDocument.Load(path))
using (var page = document.Pages[0])
using (var bitmap = page.Render(1024, 768))
{
bitmap.Save("output.png");
}
// IronPDF: Simplified
var pdf = PdfDocument.FromFile(path);
pdf.RasterizeToImageFiles("output.png");// Pdfium:要求explicit disposal
using (var document = PdfDocument.Load(path))
using (var page = document.Pages[0])
using (var bitmap = page.Render(1024, 768))
{
bitmap.Save("output.png");
}
// IronPDF: Simplified
var pdf = PdfDocument.FromFile(path);
pdf.RasterizeToImageFiles("output.png");IRON VB CONVERTER ERROR developers@ironsoftware.com移除特定平台的程式碼
// Pdfium:要求platform detection
#if WIN64
// Load x64 pdfium.dll
#else
// Load x86 pdfium.dll
#endif
// IronPDF: Remove all platform-specific code
// Just use the API directly// Pdfium:要求platform detection
#if WIN64
// Load x64 pdfium.dll
#else
// Load x86 pdfium.dll
#endif
// IronPDF: Remove all platform-specific code
// Just use the API directlyIRON VB CONVERTER ERROR developers@ironsoftware.com功能比較摘要
| 特點 | Pdfium.NET | IronPDF |
|---|---|---|
| 載入 PDF | ✓ | ✓ |
| 渲染至圖片 | ✓ | ✓ |
| 擷取文字 | ✓(基本) | ✓(進階) |
| 頁面資訊 | ✓ | ✓ |
| 從 HTML 建立 | ✗ | ✓ |
| 從 URL 建立 | ✗ | ✓ |
| 合併 PDF | ✗ | ✓ |
| 分割 PDF | ✗ | ✓ |
| 添加水印 | ✗ | ✓ |
| 頁首/頁尾 | ✗ | ✓ |
| 表格填寫 | ✗ | ✓ |
| 數位簽名 | ✗ | ✓ |
| 密碼保護 | ✗ | ✓ |
| 本地相依性 | 要求 | 無 |
| 跨平台 | 複雜的 | 自動化 |
| 記憶體管理 | 手冊處理 | 簡化 |
遷移清單
預遷移
- [確認程式碼中所有 Pdfium 的用法
- [ ] 記錄目前使用的渲染尺寸/比例
- [ ] 列出專案中的原生二進位位置
- [ ] 檢查特定平台的載入程式碼
- [ ] 確認 PDF 製作需求(目前使用的是單獨的工具嗎?)
- [ ] 檢閱轉換的處理模式
- [ ] 獲得 IronPdf 授權金鑰
套件變更
- [ ] 移除
Pdfium.NET,Pdfium.Net.SDK,PdfiumViewerNuGet 套件 - [ ] 刪除 x86/、x64/、runtimes/ 資料夾中的原生 pdfium.dll 二進位檔
- [ ] 移除特定平台的條件式編譯
- [ ] 更新 .csproj 以移除本機二進位參照
- [ ] 安裝
IronPDFNuGet 套件:dotnet add package IronPdf。
程式碼變更
- [ ] 在啟動時加入授權金鑰組態
- [ ] 使用
PdfDocument.FromFile()取代PdfDocument.Load()。 - [ ] 將
document.Save()替換為pdf.SaveAs()。 - [ ] 使用
pdf.ExtractAllText()取代document.GetPdfText(i)循環。 - [ ] 將比例係數轉換為 DPI 值 (DPI = 72 × 比例)
- [ ] 簡化處理模式(移除嵌套的 using 語句)
- [ ] 移除特定平台的程式碼
後遷移
- [ ] 測試渲染輸出品質
- [ ] 比較文字擷取結果
- [ ] 測試跨平台部署
- [ ] 新增功能(HTML 至 PDF、合併、水印、安全性)
- [ ] 更新文件
結論
從 IronPdf 遷移到 IronPDF,可將您的 PDF 工作流程從具有本機依賴複雜性的以渲染為重點的函式庫,轉換為具有建立、操作和渲染功能的全面 PDF 解決方案。
本次轉換的主要變更如下 1.範圍:僅渲染 → 完整的 PDF 解決方案 2.依賴項目: 需要原生二進位檔案 → 完全受管理 3.載入:PdfDocument.Load() → PdfDocument.FromFile() 4.儲存:Save() → SaveAs() 5.文字萃取:使用 GetPdfText() 進行手動循環 → 單次 ExtractAllText() 呼叫 6.渲染:基於比例 → 基於 DPI (DPI = 72 × 比例) 7.新功能:HTML 至 PDF、合併、水印、安全性、表單等功能
探索完整的 IronPDF說明文件、教學和 API參考,加速您的 IronPdf 遷移。






