產品比較 IronPDF與Apryse C#的比較 Curtis Chau 更新日期:7月 28, 2025 Download IronPDF NuGet 下載 DLL 下載 Windows 安裝程式 Start Free Trial Copy for LLMs Copy for LLMs Copy page as Markdown for LLMs Open in ChatGPT Ask ChatGPT about this page Open in Gemini Ask Gemini about this page Open in Grok Ask Grok about this page Open in Perplexity Ask Perplexity about this page Share Share on Facebook Share on X (Twitter) Share on LinkedIn Copy URL Email article 1. 介紹 作為 C# 開發人員,處理 PDF 是工作的一部分,尤其是在構建需要生成、編輯或顯示文檔的應用程序時。 這就是為什麼擁有一個好的 PDF 庫很重要。 這些庫通過提供內置函數來執行將文檔轉換、編輯文本和處理 PDF 文件中的圖像等複雜任務,為我們節省了時間和麻煩。 如果沒有它們,我們將不得不從頭編寫所有代碼,這不僅耗時,而且容易出錯。 In this comparison, we're looking at two popular PDF libraries: IronPDF and Apryse C#. IronPDF 以其強大的功能而聞名,這使得在 .NET 環境中輕鬆處理 PDF,從將 HTML 轉換為 PDF 到高級文檔編輯。 另一方面,Apryse C# 提供了一種簡化的 PDF 操作方法,專注於易用性和效率。 我們將深入了解每個庫提供的具體功能,幫助您決定哪一個可能最適合您的項目。 2. Apryse C Apryse C# 是一個全面的 .NET 應用程序 PDF 庫,旨在簡化在 C# 環境中進行 PDF 操作的過程。 以前稱為 PDFTron SDK。 其廣泛的功能和工具對於想要精確且輕鬆處理 PDF 的開發人員來說是無價之寶。 2.1 主要特點 輕鬆與 .NET 項目整合:Apryse C# 提供與 .NET 的無縫整合,包括 ASP.NET Core 和傳統的 .NET Framework 應用程序。 這確保開發人員可以將 PDF 功能直接整合到他們的項目中,而無需展開大量設置或配置。 文檔創建和編輯:開發人員可以使用 Apryse C# 從頭創建或編輯現有的 PDF。 這包括添加文本、圖像和表單,甚至直接在應用程序中操作 PDF 頁面,例如重新排序、合併或拆分文檔。 HTML 到 PDF 轉換:使用 Apryse C#,轉換 HTML 內容到 PDF 格式十分簡單。 此功能特別適合從網頁或 HTML 模板生成發票、報告和其他文檔。 廣泛支持表單字段:Apryse C# 為 PDF 表單字段提供強大的支持,允許開發人員以編程方式創建、編輯和填寫 PDF 表單。 這對於根據用戶輸入或外部數據源自動生成填寫的表單很理想。 文本和內容提取:該庫支持從 PDF 文檔中提取文本和其他內容。 此功能對於需要分析或處理 PDF 中包含的信息的應用程序至關重要,例如搜索工具或內容管理系統。 安全和加密:Apryse C# 提供全面的安全功能,包括加密 PDF 文檔、設置權限和管理數字簽名的能力。 這確保敏感文檔受到保護並符合合規標準。 高級 PDF 功能:開發人員可以利用高級 PDF 功能,例如註釋、書籤和超鏈接,增強他們的 PDF 文檔的交互性和可用性。 這允許創建更動態和用戶友好的 PDF。 3. IronPDF C IronPDF 作為一個多功能且強大的 PDF 庫,專為 .NET 開發人員設計。 它簡化了 PDF 操作的複雜過程,允許直接在 C# 應用程序中創建、編輯和轉換 PDF 文檔。 IronPDF 可使用於不同的編程語言,例如 Java、Python 和 C#。 IronPDF 被設計來滿足廣泛的 PDF 處理需求,成為尋求效率和可靠性的開發人員的首選解決方案。 3.1 主要特點 無縫 .NET 集成:IronPDF 確保了與 .NET 項目的輕鬆整合,支持 .NET Framework 和 .NET Core,包括 ASP.NET 項目。 這種兼容性使得應用程序能夠融入 PDF 功能而無需複雜設置。 HTML 到 PDF 轉換:IronPDF 的亮點之一是它將 HTML 轉換為 PDF 的能力。 這項功能能夠將網頁或 HTML 字串轉化為高質量的 PDF 文檔,非常適合從 HTML 模板生成報告、收據和其他文件。 高級 PDF 編輯:利用 IronPDF,開發人員能夠廣泛編輯 PDF 文檔。 這包括添加文本、圖像和矢量圖形,以及修改 PDF 文件中的現有內容。 IronPDF 提供完善的編輯工具套件,以根據特定要求定制 PDF。 PDF 表單處理:IronPDF 提供了對 PDF 表單 工作的強大支持。 它允許創建和編輯表單字段,並支持以編程方式填寫表單。 這對於自動化文檔工作流和數據輸入過程特別有用。 內容提取:該庫在從 PDF 文檔中提取文本、圖像,甚至元數據方面表現出色。 此功能支持從內容分析到數據遷移項目的一系列應用程序,使開發人員能夠有效地檢索和利用 PDF 內容。 文檔安全:IronPDF 提供了全面的安全性功能,包括支持 密碼保護、加密和 PDF 文檔權限管理。 這確保了敏感信息的安全性,並控制文檔訪問。 性能和可擴展性:IronPDF 以性能為設計導向,優化了速度和可擴展性,適合處理大量的 PDF 文檔或承擔高負荷應用程序,而不影響性能。 全面的文檔和支持:IronPDF 擁有詳盡的文檔支持和響應快速的支持團隊。 這確保了開發人員能夠獲取所需的資源和幫助,以有效地在項目中實施和排除故障 PDF 功能。 兼容各種 PDF 標準:IronPDF C# 支持廣泛的 PDF 標準,確保文檔與不同查看器兼容並符合行業規範。 This includes support for PDF/A for archival purposes, PDF/UA for accessibility, and more. 4. 創建 C# 控制台應用程序 在 Visual Studio 中創建控制台應用程序是一個對任何 .NET 開發項目,包括那些涉及使用 IronPDF 或 Apryse C# 進行 PDF 操作的項目的簡單過程。 這是如何開始的: 4.1 啟動 Visual Studio 在您的計算機上打開 Visual Studio。 如果您還沒有安裝 Visual Studio,請從微軟官方網站下載並安裝,選擇適合您需求的版本。 4.2 創建新項目 當 Visual Studio 打開時,從初始儀表板中選擇 "創建新項目" 選項。 4.3 選擇項目類型 在 "創建新項目" 窗口中,您將看到各種項目模板。 在搜索框中輸入 "Console" 或者從列表中找到 "Console 应用程序" 模板。一定要選擇專用於 C# 的模板而不是其他語言。 4.4 配置項目 選擇 "Console 应用程序" 模板後,點擊 "下一步" 按鈕。 您將被提示配置新項目: 項目名稱:輸入您的項目名稱。 位置:選擇您希望將項目保存到計算機上的位置。 解決方案名稱:默認情況下,這個名稱與您的項目名稱一致,但您可以進行修改。 框架:選擇您希望使用的 .NET 版本。 除非有具體需求,否則推薦使用最新版本。 4.5 創建項目 配置好項目的設置後,點擊 "創建" 按鈕。 Visual Studio 將設置一個具有默認 Program.cs 文件的新控制台應用程序項目。 4.6 探索項目結構 花點時間探索在解決方案資源管理器窗格中生成的項目結構。 對於控制台應用程序來說,您主要會在 Program.cs 文件中進行開發,該文件是您用來編寫 C# 代碼的地方。 5. 安裝 IronPDF 庫 將 IronPDF 庫集成到您的 .NET 項目中,可以讓您利用其全面的 PDF 操作功能。 有多種方法可安裝 IronPDF,確保您能夠根據您的首選工作流或開發環境設置進行選擇。 5.1 使用 NuGet 包管理器 Visual Studio 中的 NuGet 包管理器提供了一個用戶友好的界面來管理庫和依賴項。 在 Visual Studio 中打開項目。 導航到解決方案資源管理器,在項目上右鍵單擊,選擇 "管理 NuGet 包"。 點擊 "瀏覽" 標籤並搜索 "IronPdf"。 在搜索結果中找到 IronPDF,選擇它,然後點擊 "安裝"。Visual Studio will 處理解餘部分,將 IronPDF 添加到您的項目中。 5.2 使用 Visual Studio 命令行 對於那些更喜歡使用命令行的用戶來說,Visual Studio 中的包管理控制台提供了一種直接安裝包的方法。 打開 Visual Studio 並前往您的項目。 導航到工具 > NuGet 包管理器 > 包管理控制台。 在控制台中,輸入以下命令並按回車鍵: Install-Package IronPdf 該命令將下載並安裝最新版本的 IronPDF 到您的項目中。 5.3 從 NuGet 網頁直接下載 如果您更喜歡在將其整合到您的項目中之前手動下載包,可以從 NuGet 網站上進行下載。 訪問 NuGet 網站 並搜索 "IronPdf"。 在 IronPdf 包頁面中,找到 "下載包" 連接並點擊以下載 .nupkg 文件。 下載完成後,您可以手動將包添加到您的項目中。 在 Visual Studio 中,導航到解決方案資源管理器,在項目上右鍵單擊,選擇 "添加 > 參考"。導航到下載的 .nupkg 文件所在位置,選擇它,然後將其添加到您的項目中。 這些方法均可以成功將 IronPDF 集成到您的 .NET 項目中,讓您開始利用其強大的 PDF 處理功能。 6. 安裝 Apryse C 要將 Apryse C# 集成到您的 C# 項目中,您可以根據自己是使用 .NET Framework 還是 .NET Core 以及開發環境偏好選擇幾種選擇。 以下是根據 Apryse 文檔和設置指南中信息的綜合步驟: 6.1 適用於 .NET Framework 下載 Apryse SDK for Windows:您需要訪問 Apryse SDK for Windows 頁面 以下載適合 .NET Framework 應用程序的 SDK。 提取 SDK:下載後,將 SDK 提取到您系統的已知位置。 獲得 Apryse 試用密鑰:在 Apryse 平台上註冊以獲得試用密鑰,您將使用該密鑰來激活 SDK 的試用功能。 設置項目:在 Visual Studio 中創建一個新的 .NET Framework 控制台應用程序。 然後將提取的 SDK 中的Lib文件夾添加到您的項目目錄中。 添加引用:在項目中右鍵單擊引用,選擇 "添加引用" 並導航到您已複製 PDFNetLoader.dll 和適合您系統架構(x86 或 x64)的 PDFNet.dll 的 Lib 文件夾。 確保將 PDFNet.dll 的“本地拷貝”屬性設置為false。 配置 App.config:確保您的 App.config 文件的 loadFromRemoteSources 設置啟用為 true。 SDK 中有示例文件夾。 您可以直接打開和運行這些示例解決方案。 7. IronPDF 高級功能 7.1 HTML 到 PDF 轉換 IronPDF 在將 HTML 轉換為 PDF 文檔方面表現出色。 此功能對於需要生成報告、發票或將網頁快照轉換為 PDF 文件的網絡應用程序至關重要。 該庫準確地渲染 HTML、CSS 和 JavaScript,捕捉網頁內容的佈局和樣式到生成的 PDF 中。 7.1.1 HTML 字串到 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") $vbLabelText $csharpLabel 7.1.2 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") $vbLabelText $csharpLabel 7.1.3 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("https://dotnet.microsoft.com/en-us/download/dotnet-framework"); // 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("https://dotnet.microsoft.com/en-us/download/dotnet-framework"); // 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 = New ChromePdfRenderer() ' Render the URL as a PDF Dim pdf = renderer.RenderUrlAsPdf("https://dotnet.microsoft.com/en-us/download/dotnet-framework") ' Save the resulting PDF to a file pdf.SaveAs("url.pdf") $vbLabelText $csharpLabel Bootstrap 和現代 CSS 框架支持 從現代 web 應用程序生成 PDF 時,完整支持 Bootstrap 和 CSS 框架是必需的。 許多組織依賴於 Bootstrap 來構建他們的網頁界面,能夠準確地將這些設計轉換為 PDF 對於報告、發票和文檔至關重要。 IronPDF:完整的 Bootstrap 支持 Bootstrap 5:完整支持 flexbox 佈局、CSS 網格系統、實用類和響應式組件 Bootstrap 4:完整卡片系統、導航組件和 flex 實用工具 Tailwind CSS:所有實用工具類均準確渲染 Foundation:完整的網格系統和組件支持 現代 CSS3:完整 flexbox、CSS 網格系統、自定義屬性、動畫和過渡效果 Real-world validation: IronPDF successfully renders the Bootstrap homepage and all official examples with pixel-perfect accuracy. 代碼範例:商業指標儀表板 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='https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css' 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='https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css' 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"); IRON VB CONVERTER ERROR developers@ironsoftware.com $vbLabelText $csharpLabel 輸出:專業的商業儀表板 PDF,帶有 Bootstrap 5 的基於 flexbox 的網格系統,使用邊框實用工具的卡片組件、徽章元素、響應式表格和顏色編碼的指標—所有渲染均具備完美的佈局保持和排版。 Apryse (PDFTron):有限的現代 CSS 支持 Apryse 的 HTML2PDF 模組使用自定義渲染引擎(非 Chromium),具有明確的局限性: 部分 flexbox 支持:Bootstrap 4/5 佈局可能無法正確渲染 有限的 CSS 網格支持:現代基於網格的設計經常會失敗 JavaScript 限制:與瀏覽器環境相比,JavaScript 執行有限 框架兼容性:需要廣泛測試以適應 Bootstrap 組件 HTML2PDF 文檔明確警告說複雜的 CSS 可能無法按預期渲染,開發人員報告了導航欄、基於 flex 的卡片佈局和響應實用工具相關的問題。 開發影響:使用 Apryse 的團隊必須創建並行的 "PDF 安全" CSS 或顯著簡化 Bootstrap 佈局,增加開發負擔,限制網頁與 PDF 輸出之間的設計一致性。 有關完整的 Bootstrap 框架支持與完整 CSS3 渲染支持,請參閱 Bootstrap 和 Flexbox CSS 指南。 7.2 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") $vbLabelText $csharpLabel 7.3 添加水印 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("https://www.nuget.org/packages/IronPdf"); // 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"); 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("https://www.nuget.org/packages/IronPdf"); // 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 ' Instantiate a PDF renderer Dim renderer = New ChromePdfRenderer() ' Render a URL as a PDF Dim pdf = renderer.RenderUrlAsPdf("https://www.nuget.org/packages/IronPdf") ' 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") $vbLabelText $csharpLabel 7.4 PDF 表單 IronPDF 支持使用互動式 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 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; // 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 ' 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 = New ChromePdfRenderer() renderer.RenderingOptions.CreatePdfFormsFromHtml = True ' Render the HTML form content as a PDF renderer.RenderHtmlAsPdf(formHtml).SaveAs("EmployeeInfoForm.pdf") $vbLabelText $csharpLabel 7.5 安全與加密 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; // 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") $vbLabelText $csharpLabel 7.6 高級 PDF 編輯 IronPDF 不僅提供基本的 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; // 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") $vbLabelText $csharpLabel 8. Apryse C# 高級功能 8.1 PDF 註釋和標記 Apryse C# 允許開發人員以編程方式向 PDF 文檔添加註釋和標記。 這包括文本註釋、高亮顯示、下劃線和形狀,對於文檔審閱過程或向 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 $vbLabelText $csharpLabel 8.2 文檔轉換 利用 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 $vbLabelText $csharpLabel 8.3 内容提取和分析 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 $vbLabelText $csharpLabel 8.4 安全與加密 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 $vbLabelText $csharpLabel 8.5 修改 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 $vbLabelText $csharpLabel 9. 文檔和支持 9.1 IronPDF 文檔與支持 文檔:IronPDF 提供廣泛的文檔,涵蓋從入門指南到高級功能,如 HTML 轉換為 PDF、PDF 編輯、合併、分割和安全性等各種主題。 該文檔設計易於理解,提供大量代碼示例和解釋,引導開發人員在他們的 .NET 應用程序中實施各種與 PDF 相關的功能過程。 支持:對於需要協助的開發人員,IronPDF 通過多種渠道提供支持。 其中包括電子郵件支持、票務支持和實時工程支持聊天,您可以通過這些渠道與其技術支持團隊聯繫,以獲得特定問題的幫助。 您還可以通過支持系統提供反饋。 9.2 Apryse C# 文檔與支持 文檔:Apryse C# (以前稱為 PDFTron for .NET) 提供詳盡的文檔,包括全面的 API 參考文檔、開發指南和用於進行廣泛範圍 PDF 操作任務的示例代碼。 支持:Apryse 提供針對開發人員的支持系統,包括與其技術團隊直接電子郵件支持,用於疑難解答和實施問題的協助。 您也可以在 Stack Overflow 上提問。 10. 許可信息 10.1 IronPDF 許可 IronPDF 提供了您在定制項目需求的許可方案,包括 Lite、Plus 和 Professional 許可,報價從 Lite 許可的 $799 開始。 這些許可方案根據涵蓋的開發人員、人數和項目的數量進行區分。 此外,IronPDF 還提供免版稅再分發和擴展支持及更新的選項,並為這些附加產品提供特定費用。 IronPDF 為開發人員提供一系列永續許可選項: Lite 編制版:價格為 $799,適用於 1 名開發人員、1 個位置和 1 個項目,包含電子郵件支持。 Plus 編制版:定價 $1,199,適用於最多 3 名開發人員、3 個位置和 3 個項目,提供 24 小時電子郵件和聊天支持,還有電話支持。 Professional 編制版:價格為 $2,399,此版本適用於最多 10 名開發人員、10 個位置和 10 個項目,提供全面支持,包括電子郵件、聊天、電話和屏幕共享支持。 他們還提供每月 $500 的訂閱,包括 10,000 次 API 調用,附加調用每次 $0.02。 對於無限使用,IronPDF 提供了一個企業解決方案供請求報價。 該方案包含無限永久許可和無限 API 調用,以及其他功能。 10.2 Apryse C# 許可 Apryse C# 提供可定制的定價模型,根據項目的具體需求進行調整,包括功能、文件量和部署場景。 您需要聯繫他們的銷售團隊以獲取 Apryse 定價信息。 11. 結論 總之,IronPDF和Apryse C#為處理PDF的.NET開發人員帶來了強大的功能。 然而,IronPDF在其廣泛的PDF操作功能方面具有優勢。 它出色地處理了綜合性任務,如使用IronPDF進行PDF合併,這增加了它的吸引力。 通過Iron Suite套件,開發人員可以以具有成本效益的價格獲得一整套工具,為各種開發需求配備了強大的實用程序。 IronPDF因其整體的多功能性和價值主張在大多數PDF處理場景中脫穎而出。 最終決定理想情況下應基於項目要求和開發人員所需的具體功能。 請注意Apryse C# 是其各自所有者的註冊商標。 本網站與Apryse C#無關、未被其認可或贊助。 所有產品名稱、徽標和品牌均為其各自所有者的財產。 比較僅供信息參考,並反映撰寫時公開可用的信息。 常見問題解答 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 處理場景的理想選擇。 Curtis Chau 立即與工程團隊聊天 技術作家 Curtis Chau 擁有卡爾頓大學計算機科學學士學位,專注於前端開發,擅長於 Node.js、TypeScript、JavaScript 和 React。Curtis 熱衷於創建直觀且美觀的用戶界面,喜歡使用現代框架並打造結構良好、視覺吸引人的手冊。除了開發之外,Curtis 對物聯網 (IoT) 有著濃厚的興趣,探索將硬體和軟體結合的創新方式。在閒暇時間,他喜愛遊戲並構建 Discord 機器人,結合科技與創意的樂趣。 相關文章 發表日期 11月 13, 2025 C# HTML 與 PDF 開源版本比較 IronPDF 將開源 HTML 轉 PDF 庫與 IronPDF for C# 進行比較。探索哪種解決方案能為您的 .NET 專案提供最佳的 PDF 生成功能。 閱讀更多 發表日期 10月 27, 2025 哪個 ASP.NET Core PDF 庫具有最佳價值? 發現適用於 ASP.NET Core 應用程式的最佳 PDF 庫。比較 IronPDF 的 Chrome 引擎與 Aspose 和 Syncfusion 的替代方案。 閱讀更多 發表日期 10月 27, 2025 如何使用 Aspose C# 和 IronPDF 創建 PDF 通過這份針對開發人員設計的分步指南,學習如何使用 Aspose C# 與 IronPDF 創建 PDF。 閱讀更多 IronPDF與PDFSharpCore:2025年應選擇哪一個.NET PDF庫?IronPDF與PdfPig之間的比較
發表日期 11月 13, 2025 C# HTML 與 PDF 開源版本比較 IronPDF 將開源 HTML 轉 PDF 庫與 IronPDF for C# 進行比較。探索哪種解決方案能為您的 .NET 專案提供最佳的 PDF 生成功能。 閱讀更多
發表日期 10月 27, 2025 哪個 ASP.NET Core PDF 庫具有最佳價值? 發現適用於 ASP.NET Core 應用程式的最佳 PDF 庫。比較 IronPDF 的 Chrome 引擎與 Aspose 和 Syncfusion 的替代方案。 閱讀更多
發表日期 10月 27, 2025 如何使用 Aspose C# 和 IronPDF 創建 PDF 通過這份針對開發人員設計的分步指南,學習如何使用 Aspose C# 與 IronPDF 創建 PDF。 閱讀更多