如何在 .NET C# 中設置頁面方向和旋轉 | IronPDF
從SelectPdf遷移到IronPDF,把您的PDF生成工作流程從僅支持Windows的程式庫(其預設渲染引擎是內部WebKit,且其選擇性的Blink引擎搭載Chromium 124(2024年4月))轉移到支持最新Chromium、跨平台且具備完整CSS3和JavaScript支持的程式庫。 本指南提供了一個完整且逐步的遷移路徑,能夠部署到SelectPdf不支持的Linux、Docker、Azure Functions和其他雲平台。
為什麼從SelectPdf遷移到IronPDF
了解SelectPdf
SelectPdf是一個商業程式庫,設計用於使用C#將HTML內容轉換為PDF。 該程式庫專為需要在應用程式中無縫整合PDF生成功能的開發者設計。 SelectPdf的強項在於其簡單的API,這使它成為PDF生成新手的吸引選擇。
然而,潛在的使用者必須要了解其嚴重的限制。 根據廠商的文件,SelectPdf僅在Windows上運行,不支持Linux、macOS或Xamarin。 這對於考慮基於雲的部署解決方案如Linux Azure Functions或Docker構成了一個重大的障礙。 社區版限制每個PDF最多5頁並且在每一頁上新增水印,直到購買授權金鑰為止。 SelectPdf的預設渲染引擎是內部WebKit; 選擇性的Blink引擎搭載Chromium 124(2024年4月),這落後於當前Chrome版本,可能造成在較新的CSS功能如CSS Grid和Flexbox gap屬性上的問題。
SelectPdf的嚴重限制
| 問題 | 影響 | IronPDF解決方案 |
|---|---|---|
| 僅支持Windows | 無法部署到Linux、Docker、Azure Functions | 完整的跨平台支持 |
| 預設WebKit引擎;選擇的Blink引擎搭載Chromium 124(2024年4月) | 預設引擎上可能無法使用較新的CSS功能 | 使用最新的Chromium |
| 5頁免費版限制 | 每頁都有水印,直到購買授權 | 慷慨的試用 |
| .NET 10僅限於Windows | 無法在Linux/macOS/容器上部署 | 全平台支持.NET 10 |
| 雲部署受阻(非Windows) | 無法使用AWS Lambda或Linux Azure Functions | 原生雲支持 |
SelectPdf與IronPDF的比較
| 功能 | SelectPdf | IronPDF |
|---|---|---|
| 平台支持 | 僅限Windows | 完整跨平台,支持10多個發行版 |
| 現代Web標準支持 | 預設使用WebKit引擎; Blink選擇性引擎搭載Chromium 124(2024年4月) | 完整CSS3,使用當前Chromium |
| 最大免費版本頁數限制 | 5頁+每頁有水印 | 靈活,沒有硬性限制 |
| 定價 | 售價$499從單一開發者到$1599企业OEM | 透明靈活的定價 |
| .NET 10支持 | 支持,但僅限Windows | 支持,所有平台 |
| 雲環境下的部署 | 僅支持Windows目標 | 完全支持(Windows+Linux) |
| CSS Grid CSS 網格布局 | WebKit:有限; Blink(Chromium 124):支持 | 支援 |
| Flexbox(間隙屬性) | WebKit:不支持; Blink:支持 | 支援 |
| CSS變數 | WebKit:不支持; Blink:支持 | 支援 |
| Docker (Linux) | 不支持 | 官方映像 |
| Azure Functions (Linux) | 不支持 | 支援 |
| AWS Lambda | 不支持 | 支援 |
SelectPdf的NetCore套件針對.NET Standard 2.0目標,並被描述為相容於.NET 5到.NET 10,但僅限於Windows,這抵銷了其對於任何部署到Linux容器、AWS Lambda或基於Linux的Azure App Service開發團隊的相容性。IronPDF支持相同的.NET版本,並可在Windows、Linux、macOS和Docker上運行。
開始之前
前提條件
- .NET Environment: .NET Framework 4.6.1+ or .NET Core 3.1+ / .NET 5/6/7/8/9/10+
- NuGet存取: 有能力安裝NuGet套件
- IronPDF授權: 從ironpdf.com獲取您的授權金鑰
NuGet包變更
# Remove SelectPdf (use Select.HtmlToPdf.NetCore on .NET Core / .NET 5+)
dotnet remove package Select.HtmlToPdf
# or: dotnet remove package Select.HtmlToPdf.NetCore
# Install IronPDF
dotnet add package IronPdf
# Remove SelectPdf (use Select.HtmlToPdf.NetCore on .NET Core / .NET 5+)
dotnet remove package Select.HtmlToPdf
# or: dotnet remove package Select.HtmlToPdf.NetCore
# Install IronPDF
dotnet add package IronPdf
授權配置
// Add at application startup
IronPdf.License.LicenseKey = "YOUR-LICENSE-KEY";
// Add at application startup
IronPdf.License.LicenseKey = "YOUR-LICENSE-KEY";
' Add at application startup
IronPdf.License.LicenseKey = "YOUR-LICENSE-KEY"
完整API參考
名稱空間變更
// Before: SelectPdf
using SelectPdf;
// After: IronPDF
using IronPdf;
using IronPdf.Engines.Chrome;
// Before: SelectPdf
using SelectPdf;
// After: IronPDF
using IronPdf;
using IronPdf.Engines.Chrome;
' Before: SelectPdf
Imports SelectPdf
' After: IronPDF
Imports IronPdf
Imports IronPdf.Engines.Chrome
核心API對應
| SelectPdf | IronPDF | 注釋 |
|---|---|---|
HtmlToPdf |
ChromePdfRenderer |
核心轉換類 |
converter.ConvertHtmlString(html) |
renderer.RenderHtmlAsPdf(html) |
HTML字串轉換 |
converter.ConvertUrl(url) |
renderer.RenderUrlAsPdf(url) |
URL轉換 |
doc.Save(path) |
pdf.SaveAs(path) |
保存到檔案 |
doc.Close() |
不需要 | IronPDF處理清理 |
converter.Options.PdfPageSize |
renderer.RenderingOptions.PaperSize |
紙張大小 |
converter.Options.PdfPageOrientation |
renderer.RenderingOptions.PaperOrientation |
方向 |
converter.Options.MarginTop |
renderer.RenderingOptions.MarginTop |
上邊距 |
converter.Options.MarginBottom |
renderer.RenderingOptions.MarginBottom |
下邊距 |
converter.Options.MarginLeft |
renderer.RenderingOptions.MarginLeft |
左邊距 |
converter.Options.MarginRight |
renderer.RenderingOptions.MarginRight |
右邊距 |
PdfPageSize.A4 |
PdfPaperSize.A4 |
A4尺寸枚舉 |
PdfPageOrientation.Portrait |
PdfPaperOrientation.Portrait |
豎向枚舉 |
PdfPageOrientation.Landscape |
PdfPaperOrientation.Landscape |
橫向枚舉 |
{page_number} |
{page} |
頁碼佔位符 |
{total_pages} |
{total-pages} |
總頁數佔位符 |
程式碼遷移範例
範例1:HTML字串轉PDF
之前(SelectPdf):
// NuGet: Install-Package Select.HtmlToPdf
using SelectPdf;
using System;
class Program
{
static void Main()
{
string htmlContent = "<html><body><h1>Hello World</h1><p>This is a PDF document.</p></body></html>";
HtmlToPdf converter = new HtmlToPdf();
PdfDocument doc = converter.ConvertHtmlString(htmlContent);
doc.Save("document.pdf");
doc.Close();
Console.WriteLine("PDF generated from HTML string");
}
}
// NuGet: Install-Package Select.HtmlToPdf
using SelectPdf;
using System;
class Program
{
static void Main()
{
string htmlContent = "<html><body><h1>Hello World</h1><p>This is a PDF document.</p></body></html>";
HtmlToPdf converter = new HtmlToPdf();
PdfDocument doc = converter.ConvertHtmlString(htmlContent);
doc.Save("document.pdf");
doc.Close();
Console.WriteLine("PDF generated from HTML string");
}
}
Imports SelectPdf
Imports System
Class Program
Shared Sub Main()
Dim htmlContent As String = "<html><body><h1>Hello World</h1><p>This is a PDF document.</p></body></html>"
Dim converter As New HtmlToPdf()
Dim doc As PdfDocument = converter.ConvertHtmlString(htmlContent)
doc.Save("document.pdf")
doc.Close()
Console.WriteLine("PDF generated from HTML string")
End Sub
End Class
之後(IronPDF):
// NuGet: Install-Package IronPdf
using IronPdf;
using System;
class Program
{
static void Main()
{
string htmlContent = "<html><body><h1>Hello World</h1><p>This is a PDF document.</p></body></html>";
var renderer = new ChromePdfRenderer();
var pdf = renderer.RenderHtmlAsPdf(htmlContent);
pdf.SaveAs("document.pdf");
Console.WriteLine("PDF generated from HTML string");
}
}
// NuGet: Install-Package IronPdf
using IronPdf;
using System;
class Program
{
static void Main()
{
string htmlContent = "<html><body><h1>Hello World</h1><p>This is a PDF document.</p></body></html>";
var renderer = new ChromePdfRenderer();
var pdf = renderer.RenderHtmlAsPdf(htmlContent);
pdf.SaveAs("document.pdf");
Console.WriteLine("PDF generated from HTML string");
}
}
Imports IronPdf
Imports System
Class Program
Shared Sub Main()
Dim htmlContent As String = "<html><body><h1>Hello World</h1><p>This is a PDF document.</p></body></html>"
Dim renderer = New ChromePdfRenderer()
Dim pdf = renderer.RenderHtmlAsPdf(htmlContent)
pdf.SaveAs("document.pdf")
Console.WriteLine("PDF generated from HTML string")
End Sub
End Class
此範例演示了核心API的差異。 SelectPdf使用Close()來持久化和清理。
IronPDF使用SaveAs()保存。 Close()調用被消除,IronPDF自動處理資源管理。 查看更多HTML到PDF文件以獲得完整的範例。
範例2:URL轉PDF轉換
之前(SelectPdf):
// NuGet: Install-Package Select.HtmlToPdf
using SelectPdf;
using System;
class Program
{
static void Main()
{
HtmlToPdf converter = new HtmlToPdf();
PdfDocument doc = converter.ConvertUrl("https://www.example.com");
doc.Save("output.pdf");
doc.Close();
Console.WriteLine("PDF created successfully");
}
}
// NuGet: Install-Package Select.HtmlToPdf
using SelectPdf;
using System;
class Program
{
static void Main()
{
HtmlToPdf converter = new HtmlToPdf();
PdfDocument doc = converter.ConvertUrl("https://www.example.com");
doc.Save("output.pdf");
doc.Close();
Console.WriteLine("PDF created successfully");
}
}
Imports SelectPdf
Imports System
Class Program
Shared Sub Main()
Dim converter As New HtmlToPdf()
Dim doc As PdfDocument = converter.ConvertUrl("https://www.example.com")
doc.Save("output.pdf")
doc.Close()
Console.WriteLine("PDF created successfully")
End Sub
End Class
之後(IronPDF):
// NuGet: Install-Package IronPdf
using IronPdf;
using System;
class Program
{
static void Main()
{
var renderer = new ChromePdfRenderer();
var pdf = renderer.RenderUrlAsPdf("https://www.example.com");
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();
var pdf = renderer.RenderUrlAsPdf("https://www.example.com");
pdf.SaveAs("output.pdf");
Console.WriteLine("PDF created successfully");
}
}
Imports IronPdf
Imports System
Class Program
Shared Sub Main()
Dim renderer = New ChromePdfRenderer()
Dim pdf = renderer.RenderUrlAsPdf("https://www.example.com")
pdf.SaveAs("output.pdf")
Console.WriteLine("PDF created successfully")
End Sub
End Class
SelectPdf的RenderUrlAsPdf()。 關鍵的區別在於渲染引擎:SelectPdf預設使用內部WebKit並提供一個選擇的Blink引擎,該引擎與Chromium 124(2024年4月)一起提供,而IronPDF使用當前穩定的Chromium,支持完整CSS3和JavaScript。 在我們的教程中了解更多。
範例3:自定義頁面設置和邊距
之前(SelectPdf):
// NuGet: Install-Package Select.HtmlToPdf
using SelectPdf;
using System;
class Program
{
static void Main()
{
HtmlToPdf converter = new HtmlToPdf();
converter.Options.PdfPageSize = PdfPageSize.A4;
converter.Options.PdfPageOrientation = PdfPageOrientation.Portrait;
converter.Options.MarginTop = 20;
converter.Options.MarginBottom = 20;
converter.Options.MarginLeft = 20;
converter.Options.MarginRight = 20;
string html = "<html><body><h1>Custom Page Settings</h1></body></html>";
PdfDocument doc = converter.ConvertHtmlString(html);
doc.Save("custom-settings.pdf");
doc.Close();
Console.WriteLine("PDF with custom settings created");
}
}
// NuGet: Install-Package Select.HtmlToPdf
using SelectPdf;
using System;
class Program
{
static void Main()
{
HtmlToPdf converter = new HtmlToPdf();
converter.Options.PdfPageSize = PdfPageSize.A4;
converter.Options.PdfPageOrientation = PdfPageOrientation.Portrait;
converter.Options.MarginTop = 20;
converter.Options.MarginBottom = 20;
converter.Options.MarginLeft = 20;
converter.Options.MarginRight = 20;
string html = "<html><body><h1>Custom Page Settings</h1></body></html>";
PdfDocument doc = converter.ConvertHtmlString(html);
doc.Save("custom-settings.pdf");
doc.Close();
Console.WriteLine("PDF with custom settings created");
}
}
Imports SelectPdf
Imports System
Module Program
Sub Main()
Dim converter As New HtmlToPdf()
converter.Options.PdfPageSize = PdfPageSize.A4
converter.Options.PdfPageOrientation = PdfPageOrientation.Portrait
converter.Options.MarginTop = 20
converter.Options.MarginBottom = 20
converter.Options.MarginLeft = 20
converter.Options.MarginRight = 20
Dim html As String = "<html><body><h1>Custom Page Settings</h1></body></html>"
Dim doc As PdfDocument = converter.ConvertHtmlString(html)
doc.Save("custom-settings.pdf")
doc.Close()
Console.WriteLine("PDF with custom settings created")
End Sub
End Module
之後(IronPDF):
// NuGet: Install-Package IronPdf
using IronPdf;
using IronPdf.Engines.Chrome;
using System;
class Program
{
static void Main()
{
var renderer = new ChromePdfRenderer();
renderer.RenderingOptions.PaperSize = PdfPaperSize.A4;
renderer.RenderingOptions.PaperOrientation = PdfPaperOrientation.Portrait;
renderer.RenderingOptions.MarginTop = 20;
renderer.RenderingOptions.MarginBottom = 20;
renderer.RenderingOptions.MarginLeft = 20;
renderer.RenderingOptions.MarginRight = 20;
string html = "<html><body><h1>Custom Page Settings</h1></body></html>";
var pdf = renderer.RenderHtmlAsPdf(html);
pdf.SaveAs("custom-settings.pdf");
Console.WriteLine("PDF with custom settings created");
}
}
// NuGet: Install-Package IronPdf
using IronPdf;
using IronPdf.Engines.Chrome;
using System;
class Program
{
static void Main()
{
var renderer = new ChromePdfRenderer();
renderer.RenderingOptions.PaperSize = PdfPaperSize.A4;
renderer.RenderingOptions.PaperOrientation = PdfPaperOrientation.Portrait;
renderer.RenderingOptions.MarginTop = 20;
renderer.RenderingOptions.MarginBottom = 20;
renderer.RenderingOptions.MarginLeft = 20;
renderer.RenderingOptions.MarginRight = 20;
string html = "<html><body><h1>Custom Page Settings</h1></body></html>";
var pdf = renderer.RenderHtmlAsPdf(html);
pdf.SaveAs("custom-settings.pdf");
Console.WriteLine("PDF with custom settings created");
}
}
Imports IronPdf
Imports IronPdf.Engines.Chrome
Imports System
Module Program
Sub Main()
Dim renderer As New ChromePdfRenderer()
renderer.RenderingOptions.PaperSize = PdfPaperSize.A4
renderer.RenderingOptions.PaperOrientation = PdfPaperOrientation.Portrait
renderer.RenderingOptions.MarginTop = 20
renderer.RenderingOptions.MarginBottom = 20
renderer.RenderingOptions.MarginLeft = 20
renderer.RenderingOptions.MarginRight = 20
Dim html As String = "<html><body><h1>Custom Page Settings</h1></body></html>"
Dim pdf = renderer.RenderHtmlAsPdf(html)
pdf.SaveAs("custom-settings.pdf")
Console.WriteLine("PDF with custom settings created")
End Sub
End Module
頁面設置模式幾乎是一致的,屬性名改變如下:
converter.Options.PdfPageSize→renderer.RenderingOptions.PaperSizeconverter.Options.PdfPageOrientation→renderer.RenderingOptions.PaperOrientationPdfPageSize.A4→PdfPaperSize.A4PdfPageOrientation.Portrait→PdfPaperOrientation.Portrait
邊距屬性保持相同名稱和單位。
僅限Windows的問題
SelectPdf的平臺限制
儘管有任何行銷聲稱,SelectPdf明確不支持:
- Linux(任何版本)
- macOS
- Docker容器
- Azure Functions
- AWS Lambda
- Google Cloud Functions
- 任何基於ARM的系統
這是一個根本性的架構限制—SelectPdf依賴於特定於Windows的程式庫,且無法移植。
平台支持比較
| 平台 | SelectPdf | IronPDF |
|---|---|---|
| Windows Server 2019+ | ✅ | ✅ |
| Windows 10/11 | ✅ | ✅ |
| Ubuntu 20.04+ | ❌ | ✅ |
| Debian 10+ | ❌ | ✅ |
| CentOS 7+ | ❌ | ✅ |
| Alpine Linux | ❌ | ✅ |
| Amazon Linux 2 | ❌ | ✅ |
| macOS 10.15+ | ❌ | ✅ |
| Azure App Service(Linux) | ❌ | ✅ |
| Azure Functions | ❌ | ✅ |
| AWS Lambda | ❌ | ✅ |
| Docker(Linux) | ❌ | ✅ |
| Kubernetes | ❌ | ✅ |
過時的渲染引擎
CSS特性支持比較
SelectPdf供應三個引擎(詳見廠商文件):內部WebKit(預設),Blink(在v19.1中引入,與Chromium 124.0.6367.201一起提供—2024年4月發布)和Chromium/CEF。 預設的WebKit引擎未跟上現代網頁標準:
| CSS特性 | SelectPdf(預設WebKit) | SelectPdf(Blink,Chromium 124) | IronPDF |
|---|---|---|---|
| CSS網格 | ⚠ 部分支持/出錯 | ✅ | ✅全面 |
| Flexbox(基本) | ✅ | ✅ | ✅ |
| Flexbox(間隙屬性) | ❌ | ✅ | ✅ |
| CSS變數 | ❌ | ✅ | ✅ |
| CSS calc() | ⚠ 限制的 | ✅ | ✅ |
| @media print | ⚠ 限制的 | ✅ | ✅ |
| @font-face | ⚠ 限制的 | ✅ | ✅ |
| Web 字體 | ⚠ 限制的 | ✅ | ✅ |
| SVG | ⚠ 基礎支持 | ✅ | ✅全面 |
| CSS變換 | ⚠ 限制的 | ✅ | ✅ |
| CSS動畫 | ❌ | ⚠ 部分支持 | ✅ |
遷移後的新能力
遷移到IronPDF後,您可獲得SelectPdf無法提供的功能:
跨平台部署
// ✅IronPDF- Works everywhere
using IronPdf;
// Azure App Service(Linux) - WORKS
// Docker container - WORKS
// AWS Lambda - WORKS
// GitHub Actions on ubuntu-latest - WORKS
// macOS development - WORKS
var renderer = new ChromePdfRenderer();
var pdf = renderer.RenderHtmlAsPdf("<h1>Hello</h1>");
pdf.SaveAs("output.pdf");
// ✅IronPDF- Works everywhere
using IronPdf;
// Azure App Service(Linux) - WORKS
// Docker container - WORKS
// AWS Lambda - WORKS
// GitHub Actions on ubuntu-latest - WORKS
// macOS development - WORKS
var renderer = new ChromePdfRenderer();
var pdf = renderer.RenderHtmlAsPdf("<h1>Hello</h1>");
pdf.SaveAs("output.pdf");
Imports IronPdf
' Azure App Service(Linux) - WORKS
' Docker container - WORKS
' AWS Lambda - WORKS
' GitHub Actions on ubuntu-latest - WORKS
' macOS development - WORKS
Dim renderer As New ChromePdfRenderer()
Dim pdf = renderer.RenderHtmlAsPdf("<h1>Hello</h1>")
pdf.SaveAs("output.pdf")
現代CSS支持
// ✅IronPDF- Uses latest stable Chromium
var renderer = new ChromePdfRenderer();
var html = @"
<style>
:root { --primary: #007bff; --gap: 20px; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: var(--gap); }
</style>
<div class='grid'>
<div style='background: var(--primary); color: white; padding: 1rem;'>Item 1</div>
<div style='background: var(--primary); color: white; padding: 1rem;'>Item 2</div>
<div style='background: var(--primary); color: white; padding: 1rem;'>Item 3</div>
</div>";
var pdf = renderer.RenderHtmlAsPdf(html);
// All modern CSS features render correctly!
// ✅IronPDF- Uses latest stable Chromium
var renderer = new ChromePdfRenderer();
var html = @"
<style>
:root { --primary: #007bff; --gap: 20px; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: var(--gap); }
</style>
<div class='grid'>
<div style='background: var(--primary); color: white; padding: 1rem;'>Item 1</div>
<div style='background: var(--primary); color: white; padding: 1rem;'>Item 2</div>
<div style='background: var(--primary); color: white; padding: 1rem;'>Item 3</div>
</div>";
var pdf = renderer.RenderHtmlAsPdf(html);
// All modern CSS features render correctly!
Imports IronPdf
' ✅IronPDF- Uses latest stable Chromium
Dim renderer As New ChromePdfRenderer()
Dim html As String = "
<style>
:root { --primary: #007bff; --gap: 20px; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: var(--gap); }
</style>
<div class='grid'>
<div style='background: var(--primary); color: white; padding: 1rem;'>Item 1</div>
<div style='background: var(--primary); color: white; padding: 1rem;'>Item 2</div>
<div style='background: var(--primary); color: white; padding: 1rem;'>Item 3</div>
</div>"
Dim pdf = renderer.RenderHtmlAsPdf(html)
' All modern CSS features render correctly!
不需要Close()
IronPDF自動處理資源管理:
// Option 1: Let garbage collection handle it
var pdf = renderer.RenderHtmlAsPdf(html);
pdf.SaveAs("output.pdf");
// No Close() needed
// Option 2: Explicit disposal
using (var pdf = renderer.RenderHtmlAsPdf(html))
{
pdf.SaveAs("output.pdf");
}
// Option 1: Let garbage collection handle it
var pdf = renderer.RenderHtmlAsPdf(html);
pdf.SaveAs("output.pdf");
// No Close() needed
// Option 2: Explicit disposal
using (var pdf = renderer.RenderHtmlAsPdf(html))
{
pdf.SaveAs("output.pdf");
}
' Option 1: Let garbage collection handle it
Dim pdf = renderer.RenderHtmlAsPdf(html)
pdf.SaveAs("output.pdf")
' No Close() needed
' Option 2: Explicit disposal
Using pdf = renderer.RenderHtmlAsPdf(html)
pdf.SaveAs("output.pdf")
End Using
遷移檢查表
遷移前
- 審核程式碼庫中所有SelectPdf的使用
- 記錄現有轉換選項以便映射
- 確定頁眉/頁腳的實現方式
- 檢查頁碼佔位符語法(
{page_number}→{page}) - 記錄基礎URL處理模式
- 驗證目標部署平台
- 獲取IronPDF授權金鑰來自ironpdf.com
程式碼更新
- 移除
Select.HtmlToPdfNuGet包 - 安裝
IronPdfNuGet包 - 更新命名空間導入(
using SelectPdf;→using IronPdf;) - 用
HtmlToPdf - 用
ConvertHtmlString() - 用
ConvertUrl() - 更新選項屬性名稱(
Options.PdfPageSize→RenderingOptions.PaperSize) - 將
PdfPaperSize - 將
PdfPaperOrientation - 用
doc.Save() - 移除所有
doc.Close()調用 - 修正頁碼佔位符(
{page_number}→{total_pages}→{total-pages}) - 在應用程式啟動時新增授權初始化
遷移後
- 執行所有單元測試
- 驗證CSS渲染(特別是Grid/Flexbox)
- 測試JavaScript執行
- 驗證頁眉/頁腳頁碼
- 在目標平台上測試(Linux、Docker等)
- 性能測試
- 比較PDF輸出質量
- 更新 CI/CD 管道
- 測試雲部署(如果適用)

