產品比較 Accusoft Prizmdoc PDF Viewer教程和比較 Curtis Chau 更新日期:8月 20, 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 Accusoft PDF Viewer 提供 HTML 到 PDF 的功能,以及其他 PDF 编辑和操作任务,适用于 .NET。 IronPDF 也能够以编程方式完成这些相同的任务,节省您在 C# 项目中的时间和精力。 让我们比较两者,找出哪个最适合您的项目。 class="learnn-how-section"> class="row"> class="col-sm-6"> 比较 IronPDF 和 Accusoft PDF Viewer 将 HTML 转换为 PDF 为 PDF 设置页眉和页脚 将 PDF 转换为图像文件 比较许可、免费试用选项等 class="col-sm-6"> class="download-card"> class="tutorial-segment-title">概述 关于 IronPDF IronPDF 是一个 C# HTML 到 PDF 库。 它让工程师能够执行的任务包括从 HTML 字符串、网页、URL 创建 PDF 文件,以及设置水印、书签、页眉和页脚等属性。我们也可以将多个 PDF 文件合并为一个,或将 PDF 页面转换为图像,反之亦然。 开发是免费的,并提供 30 天的部署试用以上线您的项目。 You can download a file project from this link. 关于 Accusoft PrizmDoc Viewer PrizmDoc Viewer 是用于处理 PDF 文件并将其远程转换为其他格式的 REST API。 PrizmDoc 可以将 100 多种不同格式的文件转换为 PDF,并将 PDF 转换为 PNG、JPG、TIFF 和 SVG。 它还可以用于在应用程序中包含不同类型的电子签名选项。 比较表 IronPDF PrizmDoc Viewer 以编程方式处理 PDF 文件。 以编程方式处理 PDF 文件。 支持 .NET Core 在 Windows、Mac 或 Linux 上使用。 支持 .NET Core 在 Windows、Mac 或 Linux 上使用。 本地工作 将文档发送到远程服务器。 无论是否使用异步编程,均可工作。 必须使用 `System.Threading.Tasks` 进行异步编程。 在安装 IronPDF 后可以轻松离线工作。 必须连接互联网以向 PrizmDoc Viewer 服务器发出请求(云托管或自托管)。 提供许多预定义功能。 提供一些预定义功能。 通常需要的代码行数很少。 通常需要的代码行数较多。 每个许可证计划中每个项目可进行无限制转换。 每个云托管许可证计划中的交易次数有限。 开发免费,无时间限制。 试用仅限 300 次交易。 让我们安装这两者并比较代码。 class="tutorial-segment-title">步骤 1: 安装 1. 安装 IronPDF 库 有两种方法可以在您的项目中安装 IronPDF,采用哪一种都没有区别。 1.1. 下载 IronPDF DLL 下载 IronPDF.dll 并将其引用添加到您的项目中。 这样之后,您可以通过以下方式轻松访问命名空间 IronPdf: using IronPdf; using IronPdf; Imports IronPdf $vbLabelText $csharpLabel 现在,您可以轻松访问 IronPDF 提供的功能和类。 1.2 通过 NuGet 包管理器安装 包管理器控制台: 如果您正在使用包管理器控制台,则运行以下命令: Install-Package IronPdf 管理解决方案中的包: 如果您正在使用 NuGet 包管理器 的 GUI,则在搜索栏中浏览 IronPDF 并安装它。 从 Accusoft 安装 PrizmDoc Viewer PrizmDoc Viewer 分为两个部分,一个是作为 Restful API 的服务器端称为 PrizmDoc Server。 另一个是我们的项目,通过它我们可以访问该 API 并获取响应。 访问 PrizmDoc Server 如其名所示,它是一个服务器端应用程序,获取带有文档的基本信息作为请求(输入),并将文档转换为 PDF 文件,然后将转换后的 PDF 文件作为响应(输出)发送给客户端。 它是产品的技术核心,是一个文档处理和转换引擎。我们可以通过两种不同的方式使用它,采用哪种方式没有区别,因为它们都有相同的编程结构和技术: 自托管: 在此选项中,您需要安排自己的服务器,您可以 下载 PrizmDoc Server 并安装它。 阅读更多 关于如何在 Windows 上安装 PrizmDoc Server。 注意: 它需要至少 32 GB 内存和 4 核 CPU,否则可能会有不良体验。 云托管: 这是 PrizmDoc Viewer 的基于云的服务,您无需安排自己的服务器。 我们将使用它进行比较。 为此,创建您的帐户 然后首页会打开。 您可以从 API Key 菜单中复制 API key,稍后我们会看到如何使用它。 首先,我们将看到使用 PrizmDoc Viewer 将文档转换为 PDF 文件的基本结构,并直接在 C# 控制台应用程序中与 Accusoft server 进行交互。 注意: 以下示例仅用于对 PrizmDoc 如何处理 PDF 文件的概念理解。 它有点长,所以如果您跳过这个例子并 直接进入比较 没问题。 Accusoft 工作结构 在本例中,我们将 myWebpage.html 转换为 sample.pdf 文件。 注意: 我们必须安装 Newtonsoft.Json 库并在项目中添加其引用。 首先,将以下库添加到您的项目中: using System; using System.IO; using System.Net; using System.Text; using System.Threading.Tasks; using Newtonsoft.Json.Linq; // Install Newtonsoft.Json via NuGet Package Manager using System; using System.IO; using System.Net; using System.Text; using System.Threading.Tasks; using Newtonsoft.Json.Linq; // Install Newtonsoft.Json via NuGet Package Manager Imports System Imports System.IO Imports System.Net Imports System.Text Imports System.Threading.Tasks Imports Newtonsoft.Json.Linq ' Install Newtonsoft.Json via NuGet Package Manager $vbLabelText $csharpLabel 然后创建一个公共变量 Accusoft API Key 并将您的 API Key 粘贴在其中,如下所示: static string ApiKey = "Your-API-KEY"; static string ApiKey = "Your-API-KEY"; Private Shared ApiKey As String = "Your-API-KEY" $vbLabelText $csharpLabel 使用 PrizmDoc Viewer 处理 PDF 文件有 3 个步骤: 将文件上传到 PrizmDoc 服务器。 转换上传的文件。 从 PrizmDoc 服务器下载转换后的文件。 因此,我们将为每一步单独创建一个函数。 static void Main(string[] args) { //---Upload file to Server--- JObject uploadResults = UploadToServer("myWebpage.html").Result; string fileID = (string)uploadResults.SelectToken("fileId"); string affinityToken = (string)uploadResults.SelectToken("affinityToken"); //---Convert the uploaded file to PDF--- JObject convertResults = Convert(affinityToken, fileID).Result; string processId = (string)convertResults.SelectToken("processId"); affinityToken = (string)convertResults.SelectToken("affinityToken"); //---Check the status that conversion is completed--- JObject convertStatusResults = ConvertStatus(processId, affinityToken).Result; string convertStatus = (string)convertStatusResults.SelectToken("state"); //---Continuously checking whether conversion completed--- while (!(convertStatus.Equals("complete"))) { System.Threading.Thread.Sleep(30000); convertStatusResults = ConvertStatus(processId, affinityToken).Result; convertStatus = (string)convertStatusResults.SelectToken("state"); } //---Download the converted file from server--- string newFileID = (string)convertStatusResults.SelectToken("output.results[0].fileId"); DownloadFromServer(affinityToken, newFileID, "sample.pdf").Wait(); Console.WriteLine("PDF file created successfully...!"); Console.ReadKey(); } static void Main(string[] args) { //---Upload file to Server--- JObject uploadResults = UploadToServer("myWebpage.html").Result; string fileID = (string)uploadResults.SelectToken("fileId"); string affinityToken = (string)uploadResults.SelectToken("affinityToken"); //---Convert the uploaded file to PDF--- JObject convertResults = Convert(affinityToken, fileID).Result; string processId = (string)convertResults.SelectToken("processId"); affinityToken = (string)convertResults.SelectToken("affinityToken"); //---Check the status that conversion is completed--- JObject convertStatusResults = ConvertStatus(processId, affinityToken).Result; string convertStatus = (string)convertStatusResults.SelectToken("state"); //---Continuously checking whether conversion completed--- while (!(convertStatus.Equals("complete"))) { System.Threading.Thread.Sleep(30000); convertStatusResults = ConvertStatus(processId, affinityToken).Result; convertStatus = (string)convertStatusResults.SelectToken("state"); } //---Download the converted file from server--- string newFileID = (string)convertStatusResults.SelectToken("output.results[0].fileId"); DownloadFromServer(affinityToken, newFileID, "sample.pdf").Wait(); Console.WriteLine("PDF file created successfully...!"); Console.ReadKey(); } Shared Sub Main(ByVal args() As String) '---Upload file to Server--- Dim uploadResults As JObject = UploadToServer("myWebpage.html").Result Dim fileID As String = CStr(uploadResults.SelectToken("fileId")) Dim affinityToken As String = CStr(uploadResults.SelectToken("affinityToken")) '---Convert the uploaded file to PDF--- Dim convertResults As JObject = Convert(affinityToken, fileID).Result Dim processId As String = CStr(convertResults.SelectToken("processId")) affinityToken = CStr(convertResults.SelectToken("affinityToken")) '---Check the status that conversion is completed--- Dim convertStatusResults As JObject = ConvertStatus(processId, affinityToken).Result Dim convertStatus As String = CStr(convertStatusResults.SelectToken("state")) '---Continuously checking whether conversion completed--- Do While Not (convertStatus.Equals("complete")) System.Threading.Thread.Sleep(30000) convertStatusResults = ConvertStatus(processId, affinityToken).Result convertStatus = CStr(convertStatusResults.SelectToken("state")) Loop '---Download the converted file from server--- Dim newFileID As String = CStr(convertStatusResults.SelectToken("output.results[0].fileId")) DownloadFromServer(affinityToken, newFileID, "sample.pdf").Wait() Console.WriteLine("PDF file created successfully...!") Console.ReadKey() End Sub $vbLabelText $csharpLabel 1. 将文件上传到服务器: public static async Task<JObject> UploadToServer(string fileToUpload) { FileInfo input = new FileInfo(fileToUpload); if (input == null) { throw new ArgumentException("Missing parameter input", nameof(input)); } var fileName = input.Name; var endpoint = new Uri("https://api.accusoft.com/PCCIS/V1/WorkFile"); using (var client = new WebClient()) { client.Headers.Add("acs-api-key", ApiKey); client.Headers.Add("Content-Type", "application/octet-stream"); using (var reader = new BinaryReader(input.OpenRead())) { var data = reader.ReadBytes((int)reader.BaseStream.Length); var results = await client.UploadDataTaskAsync(endpoint, "POST", data); string getResult = Encoding.ASCII.GetString(results); return JObject.Parse(getResult); } } } public static async Task<JObject> UploadToServer(string fileToUpload) { FileInfo input = new FileInfo(fileToUpload); if (input == null) { throw new ArgumentException("Missing parameter input", nameof(input)); } var fileName = input.Name; var endpoint = new Uri("https://api.accusoft.com/PCCIS/V1/WorkFile"); using (var client = new WebClient()) { client.Headers.Add("acs-api-key", ApiKey); client.Headers.Add("Content-Type", "application/octet-stream"); using (var reader = new BinaryReader(input.OpenRead())) { var data = reader.ReadBytes((int)reader.BaseStream.Length); var results = await client.UploadDataTaskAsync(endpoint, "POST", data); string getResult = Encoding.ASCII.GetString(results); return JObject.Parse(getResult); } } } Public Shared Async Function UploadToServer(ByVal fileToUpload As String) As Task(Of JObject) Dim input As New FileInfo(fileToUpload) If input Is Nothing Then Throw New ArgumentException("Missing parameter input", NameOf(input)) End If Dim fileName = input.Name Dim endpoint = New Uri("https://api.accusoft.com/PCCIS/V1/WorkFile") Using client = New WebClient() client.Headers.Add("acs-api-key", ApiKey) client.Headers.Add("Content-Type", "application/octet-stream") Using reader = New BinaryReader(input.OpenRead()) Dim data = reader.ReadBytes(CInt(reader.BaseStream.Length)) Dim results = Await client.UploadDataTaskAsync(endpoint, "POST", data) Dim getResult As String = Encoding.ASCII.GetString(results) Return JObject.Parse(getResult) End Using End Using End Function $vbLabelText $csharpLabel 2. 将上传的文件转换为 PDF: public static async Task<JObject> Convert(string affinityToken, string fileID) { var endpoint = new Uri("https://api.accusoft.com/v2/contentConverters"); using (var client = new WebClient()) { client.Headers.Add("Content-Type", "application/json"); client.Headers.Add("acs-api-key", ApiKey); client.Headers.Add("Accusoft-Affinity-Token", affinityToken); JObject myJson = new JObject( new JProperty("input", new JObject( new JProperty("sources", new JArray( new JObject( new JProperty("fileId", fileID) ) ) ), new JProperty("dest", new JObject( new JProperty("format", "pdf") ) ) ) ) ); string results = await client.UploadStringTaskAsync(endpoint, "POST", myJson.ToString()); return JObject.Parse(results); } } public static async Task<JObject> Convert(string affinityToken, string fileID) { var endpoint = new Uri("https://api.accusoft.com/v2/contentConverters"); using (var client = new WebClient()) { client.Headers.Add("Content-Type", "application/json"); client.Headers.Add("acs-api-key", ApiKey); client.Headers.Add("Accusoft-Affinity-Token", affinityToken); JObject myJson = new JObject( new JProperty("input", new JObject( new JProperty("sources", new JArray( new JObject( new JProperty("fileId", fileID) ) ) ), new JProperty("dest", new JObject( new JProperty("format", "pdf") ) ) ) ) ); string results = await client.UploadStringTaskAsync(endpoint, "POST", myJson.ToString()); return JObject.Parse(results); } } Public Shared Async Function Convert(ByVal affinityToken As String, ByVal fileID As String) As Task(Of JObject) Dim endpoint = New Uri("https://api.accusoft.com/v2/contentConverters") Using client = New WebClient() client.Headers.Add("Content-Type", "application/json") client.Headers.Add("acs-api-key", ApiKey) client.Headers.Add("Accusoft-Affinity-Token", affinityToken) Dim myJson As New JObject(New JProperty("input", New JObject(New JProperty("sources", New JArray(New JObject(New JProperty("fileId", fileID)))), New JProperty("dest", New JObject(New JProperty("format", "pdf")))))) Dim results As String = Await client.UploadStringTaskAsync(endpoint, "POST", myJson.ToString()) Return JObject.Parse(results) End Using End Function $vbLabelText $csharpLabel 以下 JSON 是 myJson 对象的结果值: { "input": { "sources": [ {"fileId": "Auto Generated FileId Value"} ], "dest": { "format": "pdf" } } } 检查转换是否完成的状态 public static async Task<JObject> ConvertStatus(string processId, string affinityToken) { string endpoint = "https://api.accusoft.com/v2/contentConverters/" + processId; using (var client = new WebClient()) { client.BaseAddress = endpoint; client.Headers.Add("acs-api-key", ApiKey); client.Headers.Add("Accusoft-Affinity-Token", affinityToken); string results = await client.DownloadStringTaskAsync(endpoint); return JObject.Parse(results); } } public static async Task<JObject> ConvertStatus(string processId, string affinityToken) { string endpoint = "https://api.accusoft.com/v2/contentConverters/" + processId; using (var client = new WebClient()) { client.BaseAddress = endpoint; client.Headers.Add("acs-api-key", ApiKey); client.Headers.Add("Accusoft-Affinity-Token", affinityToken); string results = await client.DownloadStringTaskAsync(endpoint); return JObject.Parse(results); } } Public Shared Async Function ConvertStatus(ByVal processId As String, ByVal affinityToken As String) As Task(Of JObject) Dim endpoint As String = "https://api.accusoft.com/v2/contentConverters/" & processId Using client = New WebClient() client.BaseAddress = endpoint client.Headers.Add("acs-api-key", ApiKey) client.Headers.Add("Accusoft-Affinity-Token", affinityToken) Dim results As String = Await client.DownloadStringTaskAsync(endpoint) Return JObject.Parse(results) End Using End Function $vbLabelText $csharpLabel 3. 从服务器下载转换后的文件 public static async Task DownloadFromServer(string affinityToken, string fileId, string outfile) { var endpoint = new Uri("https://api.accusoft.com/PCCIS/V1/WorkFile/" + fileId); using (var client = new WebClient()) { client.Headers.Add("acs-api-key", ApiKey); client.Headers.Add("Accusoft-Affinity-Token", affinityToken); FileInfo output = new FileInfo(outfile); using (var writeStream = output.Create()) { var results = await client.DownloadDataTaskAsync(endpoint); await writeStream.WriteAsync(results, 0, results.Length); } } } public static async Task DownloadFromServer(string affinityToken, string fileId, string outfile) { var endpoint = new Uri("https://api.accusoft.com/PCCIS/V1/WorkFile/" + fileId); using (var client = new WebClient()) { client.Headers.Add("acs-api-key", ApiKey); client.Headers.Add("Accusoft-Affinity-Token", affinityToken); FileInfo output = new FileInfo(outfile); using (var writeStream = output.Create()) { var results = await client.DownloadDataTaskAsync(endpoint); await writeStream.WriteAsync(results, 0, results.Length); } } } Public Shared Async Function DownloadFromServer(ByVal affinityToken As String, ByVal fileId As String, ByVal outfile As String) As Task Dim endpoint = New Uri("https://api.accusoft.com/PCCIS/V1/WorkFile/" & fileId) Using client = New WebClient() client.Headers.Add("acs-api-key", ApiKey) client.Headers.Add("Accusoft-Affinity-Token", affinityToken) Dim output As New FileInfo(outfile) Using writeStream = output.Create() Dim results = Await client.DownloadDataTaskAsync(endpoint) Await writeStream.WriteAsync(results, 0, results.Length) End Using End Using End Function $vbLabelText $csharpLabel 上述例子需要花费很多精力! 为了减轻工作负担,Accusoft 引入了一个 .NET 库名为 Accusoft.PrizmDocServerSDK,它是 PrizmDoc Server REST API 的包装。 让我们看看如何在我们的 .NET 项目中安装和使用此库 安装 Accusoft.PrizmDocServerSDK 有两种方法可以安装此包装。 包管理器控制台: 如果您正在使用包管理器控制台,请运行以下命令: Install-Package Accusoft.PrizmDocServerSDK Install-Package Accusoft.PrizmDocServerSDK SHELL 管理解决方案中的包: 如果您正在使用 NuGet 包管理器的 GUI,请在搜索栏中浏览 Accusoft.PrizmDocServerSDK 并安装它。 现在,您可以轻松访问 Accusoft.PrizmDocServer 命名空间并通过访问使用它: using Accusoft.PrizmDocServer; using Accusoft.PrizmDocServer; Imports Accusoft.PrizmDocServer $vbLabelText $csharpLabel class="tutorial-segment-title">如何使用教程 2. IronPDF 与 PrizmDoc Viewer 代码比较 在阅读了这两个组件的介绍和安装之后,现在是时候与这两个组件一起工作了。 为此,我们将采用一些用例并使用这两个组件实现它们。 我们希望这提供了一种轻松理解两种编程结构并得出哪个对您的项目更好的结论的方法。 3. 将 HTML 转换为 PDF 文件 在我们的第一次比较中,假设我们有一个名为 myWebPage.html 的网页,并希望从中创建一个 PDF 文件,然后将其保存到目标位置。 3.1. IronPDF HTML 到 PDF using IronPdf; static void Main(string[] args) { // Create rendering converter var converter = new ChromePdfRenderer(); // Render HTML file to PDF using var PDF = converter.RenderHTMLFileAsPdf("myWebPage.html"); // Save to target location PDF.SaveAs("sample.pdf"); } using IronPdf; static void Main(string[] args) { // Create rendering converter var converter = new ChromePdfRenderer(); // Render HTML file to PDF using var PDF = converter.RenderHTMLFileAsPdf("myWebPage.html"); // Save to target location PDF.SaveAs("sample.pdf"); } Imports IronPdf Shared Sub Main(ByVal args() As String) ' Create rendering converter Dim converter = New ChromePdfRenderer() ' Render HTML file to PDF Dim PDF = converter.RenderHTMLFileAsPdf("myWebPage.html") ' Save to target location PDF.SaveAs("sample.pdf") End Sub $vbLabelText $csharpLabel 上述代码将创建一个 sample.pdf 文件,并将其保存到项目的 bin>debug 文件夹。 您也可以指定任何路径,如下所示: PDF.SaveAs("E:/sample.pdf"); 查看更多 关于如何使用 IronPDF 处理 PDF 文件。 现在,我们将使用 PrizmDoc Viewer 做相同的任务,以便我们的比较变得简单。 3.2. PrizmDoc Viewer HTML 到 PDF 在 PrizmDoc Viewer 的安装中,我们已经讨论了如何获取 Accusoft API Key,现在我们将看到如何使用它。 首先,我们向 PrizmDoc 服务器发送请求,并从中获取响应。 这个过程将花费一些时间,因此我们需要使用异步编程。 注意: 确保您的系统在使用 PrizmDoc Viewer 的云服务创建 PDF 文件时已连接到互联网。 using Accusoft.PrizmDocServer; using Accusoft.PrizmDocServer.Conversion; static void Main(string[] args) { ChromePdfRenderer().GetAwaiter().GetResult(); } private static async Task ChromePdfRenderer() { // Instantiate PrizmDocServerClient object var prizmDocServer = new PrizmDocServerClient("https://api.accusoft.com", "Your-API-KEY"); // Specify HTML file and convert it to a PDF. ConversionResult result = await prizmDocServer.ConvertToPdfAsync("myWebPage.html"); // Save PDF file to the target location await result.RemoteWorkFile.SaveAsync("sample.pdf"); } using Accusoft.PrizmDocServer; using Accusoft.PrizmDocServer.Conversion; static void Main(string[] args) { ChromePdfRenderer().GetAwaiter().GetResult(); } private static async Task ChromePdfRenderer() { // Instantiate PrizmDocServerClient object var prizmDocServer = new PrizmDocServerClient("https://api.accusoft.com", "Your-API-KEY"); // Specify HTML file and convert it to a PDF. ConversionResult result = await prizmDocServer.ConvertToPdfAsync("myWebPage.html"); // Save PDF file to the target location await result.RemoteWorkFile.SaveAsync("sample.pdf"); } Imports Accusoft.PrizmDocServer Imports Accusoft.PrizmDocServer.Conversion Shared Sub Main(ByVal args() As String) ChromePdfRenderer().GetAwaiter().GetResult() End Sub Private Shared Async Function ChromePdfRenderer() As Task ' Instantiate PrizmDocServerClient object Dim prizmDocServer = New PrizmDocServerClient("https://api.accusoft.com", "Your-API-KEY") ' Specify HTML file and convert it to a PDF. Dim result As ConversionResult = Await prizmDocServer.ConvertToPdfAsync("myWebPage.html") ' Save PDF file to the target location Await result.RemoteWorkFile.SaveAsync("sample.pdf") End Function $vbLabelText $csharpLabel 阅读更多 关于如何使用 PrizmDoc Viewer。 3.3. HTML 到 PDF 代码比较 我们从这些例子中看到,IronPDF 创建 PDF 文件的方法更简单,不需要那么多时间。 4. 图像到 PDF 在本次比较中,我们假设需要通过图像创建一个 PDF 文件,并且该图像存在于项目的 debug 文件夹中。 让我们从 IronPDF 开始。 4.1. IronPDF 图像到 PDF using IronPdf; static void Main(string[] args) { // Specify the image to be converted using var converted = ImageToPdfConverter.ImageToPdf("google.png"); // Save PDF file to the target location converted.SaveAs("sample.pdf"); } using IronPdf; static void Main(string[] args) { // Specify the image to be converted using var converted = ImageToPdfConverter.ImageToPdf("google.png"); // Save PDF file to the target location converted.SaveAs("sample.pdf"); } Imports IronPdf Shared Sub Main(ByVal args() As String) ' Specify the image to be converted Dim converted = ImageToPdfConverter.ImageToPdf("google.png") ' Save PDF file to the target location converted.SaveAs("sample.pdf") End Sub $vbLabelText $csharpLabel 输出: 此截图是使用上述代码创建的新 PDF 文件 sample.pdf: class="content-img-align-center"> class="center-image-wrapper"> 我们可以看到使用 IronPDF 从图像创建 PDF 文件是多么的简单。 现在,我们将使用 PrizmDoc Viewer 执行相同的任务,并查看其生成的 PDF 文件。 4.2. PrizmDoc Viewer 图像到 PDF using Accusoft.PrizmDocServer; using Accusoft.PrizmDocServer.Conversion; static void Main(string[] args) { ImageToPDF().GetAwaiter().GetResult(); } private static async Task ImageToPDF() { // Instantiate PrizmDocServerClient object var prizmDocServer = new PrizmDocServerClient("https://api.accusoft.com", "Your-API-KEY"); // Specify the image to be converted ConversionResult results = await prizmDocServer.ConvertToPdfAsync("google.png"); // Save PDF file to the target location await results.RemoteWorkFile.SaveAsync("sample.pdf"); } using Accusoft.PrizmDocServer; using Accusoft.PrizmDocServer.Conversion; static void Main(string[] args) { ImageToPDF().GetAwaiter().GetResult(); } private static async Task ImageToPDF() { // Instantiate PrizmDocServerClient object var prizmDocServer = new PrizmDocServerClient("https://api.accusoft.com", "Your-API-KEY"); // Specify the image to be converted ConversionResult results = await prizmDocServer.ConvertToPdfAsync("google.png"); // Save PDF file to the target location await results.RemoteWorkFile.SaveAsync("sample.pdf"); } Imports Accusoft.PrizmDocServer Imports Accusoft.PrizmDocServer.Conversion Shared Sub Main(ByVal args() As String) ImageToPDF().GetAwaiter().GetResult() End Sub Private Shared Async Function ImageToPDF() As Task ' Instantiate PrizmDocServerClient object Dim prizmDocServer = New PrizmDocServerClient("https://api.accusoft.com", "Your-API-KEY") ' Specify the image to be converted Dim results As ConversionResult = Await prizmDocServer.ConvertToPdfAsync("google.png") ' Save PDF file to the target location Await results.RemoteWorkFile.SaveAsync("sample.pdf") End Function $vbLabelText $csharpLabel 输出: This screenshot is of a newly created PDF file sample.pdf from the above code: class="content-img-align-center"> class="center-image-wrapper"> 4.3. 图像到 PDF 代码比较 我们可以看到,使用 IronPDF,我们只需编写 2 行简单的代码就可以。 另一方面,使用 PrizmDoc 服务器,我们必须编写许多代码行以及使用异步编程。 IronPDF 的输出还自动提供了一个可用的全页面文档。 5. 合并 PDF 文件 在本次比较中,假设我们有三个名为 A.pdf、B.pdf 和 C.pdf 的 PDF 文件。 我们希望将它们合并为一个 PDF 文件,我们可以使用这两个组件来完成这个任务。 首先,我们将看看如何使用 IronPDF 执行此任务。 5.1. IronPDF 合并 PDF 文件 using IronPdf; using System.Collections.Generic; static void Main(string[] args) { // Create rendering converter var Renderer = new IronPdf.ChromePdfRenderer(); // Create a list of pdf files var PDFs = new List<PdfDocument>(); PDFs.Add(PdfDocument.FromFile("A.pdf")); PDFs.Add(PdfDocument.FromFile("B.pdf")); PDFs.Add(PdfDocument.FromFile("C.pdf")); // Merge the list of pdf file using PdfDocument PDF = PdfDocument.Merge(PDFs); // Save merged file to the target location PDF.SaveAs("sample.pdf"); foreach(var pdf in PDFs) { pdf.Dispose(); } } using IronPdf; using System.Collections.Generic; static void Main(string[] args) { // Create rendering converter var Renderer = new IronPdf.ChromePdfRenderer(); // Create a list of pdf files var PDFs = new List<PdfDocument>(); PDFs.Add(PdfDocument.FromFile("A.pdf")); PDFs.Add(PdfDocument.FromFile("B.pdf")); PDFs.Add(PdfDocument.FromFile("C.pdf")); // Merge the list of pdf file using PdfDocument PDF = PdfDocument.Merge(PDFs); // Save merged file to the target location PDF.SaveAs("sample.pdf"); foreach(var pdf in PDFs) { pdf.Dispose(); } } Imports IronPdf Imports System.Collections.Generic Shared Sub Main(ByVal args() As String) ' Create rendering converter Dim Renderer = New IronPdf.ChromePdfRenderer() ' Create a list of pdf files Dim PDFs = New List(Of PdfDocument)() PDFs.Add(PdfDocument.FromFile("A.pdf")) PDFs.Add(PdfDocument.FromFile("B.pdf")) PDFs.Add(PdfDocument.FromFile("C.pdf")) ' Merge the list of pdf file Using PDF As PdfDocument = PdfDocument.Merge(PDFs) ' Save merged file to the target location PDF.SaveAs("sample.pdf") 'INSTANT VB NOTE: The variable pdf was renamed since Visual Basic will not allow local variables with the same name as parameters or other local variables: For Each .pdf_Conflict In PDFs .pdf_Conflict.Dispose() Next pdf_Conflict End Using End Sub $vbLabelText $csharpLabel 上面的代码将创建一个 sample.pdf 文件,该文件是 A.pdf、B.pdf 和 C.pdf 的组合。 现在,我们将使用 PrizmDoc Viewer 执行相同的任务。 5.2. PrizmDoc Viewer 合并 PDF 文件 using System.Threading.Tasks; using Accusoft.PrizmDocServer; using Accusoft.PrizmDocServer.Conversion; static void Main(string[] args) { PdfMerge().GetAwaiter().GetResult(); } private static async Task PdfMerge() { // Instantiate PrizmDocServerClient object var prizmDocServer = new PrizmDocServerClient("https://api.accusoft.com", "Your-API-KEY"); // Pass the list of pdf files to PrizmDoc Server ConversionResult result = await prizmDocServer.CombineToPdfAsync( new [] { new ConversionSourceDocument("A.pdf"), new ConversionSourceDocument("B.pdf"), new ConversionSourceDocument("C.pdf"), }); // Save merged file to the target location await result.RemoteWorkFile.SaveAsync("sample.pdf"); } using System.Threading.Tasks; using Accusoft.PrizmDocServer; using Accusoft.PrizmDocServer.Conversion; static void Main(string[] args) { PdfMerge().GetAwaiter().GetResult(); } private static async Task PdfMerge() { // Instantiate PrizmDocServerClient object var prizmDocServer = new PrizmDocServerClient("https://api.accusoft.com", "Your-API-KEY"); // Pass the list of pdf files to PrizmDoc Server ConversionResult result = await prizmDocServer.CombineToPdfAsync( new [] { new ConversionSourceDocument("A.pdf"), new ConversionSourceDocument("B.pdf"), new ConversionSourceDocument("C.pdf"), }); // Save merged file to the target location await result.RemoteWorkFile.SaveAsync("sample.pdf"); } Imports System.Threading.Tasks Imports Accusoft.PrizmDocServer Imports Accusoft.PrizmDocServer.Conversion Shared Sub Main(ByVal args() As String) PdfMerge().GetAwaiter().GetResult() End Sub Private Shared Async Function PdfMerge() As Task ' Instantiate PrizmDocServerClient object Dim prizmDocServer = New PrizmDocServerClient("https://api.accusoft.com", "Your-API-KEY") ' Pass the list of pdf files to PrizmDoc Server Dim result As ConversionResult = Await prizmDocServer.CombineToPdfAsync( { New ConversionSourceDocument("A.pdf"), New ConversionSourceDocument("B.pdf"), New ConversionSourceDocument("C.pdf") }) ' Save merged file to the target location Await result.RemoteWorkFile.SaveAsync("sample.pdf") End Function $vbLabelText $csharpLabel 上面的代码也将创建一个 sample.pdf 文件,该文件是 A.pdf、B.pdf 和 C.pdf 文件的组合。 6. PDF 页眉和页脚 在本次比较中,假设我们有一个简单的网页名为 myWebPage.html,包含以下 HTML 和 CSS: <html> <head> <style> li { font-size: x-large; color: rgba(156, 89, 13, 0.897); list-style: square; } </style> </head> <body> <h1 style="text-align: center;">Hello World..!</h1> <h1>Main Menu</h1> <ul> <li>SubMenu 1</li> <li>SubMenu 2</li> <li>SubMenu 3</li> <li>SubMenu 4</li> <li>SubMenu 5</li> </ul> </body> </html> <html> <head> <style> li { font-size: x-large; color: rgba(156, 89, 13, 0.897); list-style: square; } </style> </head> <body> <h1 style="text-align: center;">Hello World..!</h1> <h1>Main Menu</h1> <ul> <li>SubMenu 1</li> <li>SubMenu 2</li> <li>SubMenu 3</li> <li>SubMenu 4</li> <li>SubMenu 5</li> </ul> </body> </html> HTML 我们希望将此网页转换为 PDF 文件,并设置以下页眉和页脚属性: 在页眉左侧的 页面标题, 页眉右侧的 日期时间 在页脚右侧显示的 页码和总页数。 首先,我们将看看如何使用 IronPDF 来设置页眉和页脚。 6.1. IronPDF PDF 页眉和页脚 要处理 PDF 文件的页眉和页脚,IronPDF 在 ChromePdfRenderer 类中提供了一个名为 RenderingOptions 的属性,可以按如下方式使用: 页眉: ChromePdfRenderer_Obj.RenderingOptions.TextHeader = new TextHeaderFooter(); ChromePdfRenderer_Obj.RenderingOptions.TextHeader = new TextHeaderFooter(); ChromePdfRenderer_Obj.RenderingOptions.TextHeader = New TextHeaderFooter() $vbLabelText $csharpLabel 页脚: ChromePdfRenderer_Obj.RenderingOptions.TextFooter = new TextHeaderFooter(); ChromePdfRenderer_Obj.RenderingOptions.TextFooter = new TextHeaderFooter(); ChromePdfRenderer_Obj.RenderingOptions.TextFooter = New TextHeaderFooter() $vbLabelText $csharpLabel 在初始化 TextHeaderFooter() 时,我们可以设置以下属性: CenterText 在页眉或页脚中居中打印文本。 LeftText 在页眉或页脚左侧打印文本。 RightText 在页眉或页脚右侧打印文本。 DrawDividerLine 它画一条线,将页面内容与页眉或页脚分开。 FontFamily 指定页眉或页脚的字体族。 FontSize 指定页眉或页脚的字体大小。 Spacing 调整页面内容与页眉或页脚之间的间距。 一些以下预定义的属性对于设置页眉或页脚内容非常有帮助。 它可以在大括号 { } 中编写,如下所示: {page} 在页眉或页脚中打印当前页码。 {total-pages} 在页眉或页脚中打印总页数。 {url} 用于在页眉或页脚中打印渲染页面的 URL。 {date} 在页眉或页脚中打印当前日期。 {time} 在页眉或页脚中打印当前时间。 {html-title} 在页眉或页脚中打印渲染网页的标题。 {pdf-title} 在页眉或页脚中打印文档标题。 阅读更多 了解有关使用 IronPDF 处理页眉和页脚的详细信息。 让我们看看以下示例来实现用例并演示如何使用上述属性设置 PDF 文件的页眉和页脚。 using IronPdf; static void Main(string[] args) { // Create rendering converter var converter = new ChromePdfRenderer(); // Setting Header properties converter.RenderingOptions.TextHeader = new TextHeaderFooter() { DrawDividerLine = true, LeftText = "Page Title", RightText = "{date} {time}", FontSize = 13 }; // Setting footer properties converter.RenderingOptions.TextFooter = new TextHeaderFooter() { RightText = "Page {page} of {total-pages}", FontSize = 12 }; // Specify the file to be converted using var PDF = converter.RenderHTMLFileAsPdf("myWebPage.html"); // Save to target location PDF.SaveAs("sample.pdf"); } using IronPdf; static void Main(string[] args) { // Create rendering converter var converter = new ChromePdfRenderer(); // Setting Header properties converter.RenderingOptions.TextHeader = new TextHeaderFooter() { DrawDividerLine = true, LeftText = "Page Title", RightText = "{date} {time}", FontSize = 13 }; // Setting footer properties converter.RenderingOptions.TextFooter = new TextHeaderFooter() { RightText = "Page {page} of {total-pages}", FontSize = 12 }; // Specify the file to be converted using var PDF = converter.RenderHTMLFileAsPdf("myWebPage.html"); // Save to target location PDF.SaveAs("sample.pdf"); } Imports IronPdf Shared Sub Main(ByVal args() As String) ' Create rendering converter Dim converter = New ChromePdfRenderer() ' Setting Header properties converter.RenderingOptions.TextHeader = New TextHeaderFooter() With { .DrawDividerLine = True, .LeftText = "Page Title", .RightText = "{date} {time}", .FontSize = 13 } ' Setting footer properties converter.RenderingOptions.TextFooter = New TextHeaderFooter() With { .RightText = "Page {page} of {total-pages}", .FontSize = 12 } ' Specify the file to be converted Dim PDF = converter.RenderHTMLFileAsPdf("myWebPage.html") ' Save to target location PDF.SaveAs("sample.pdf") End Sub $vbLabelText $csharpLabel 输出: The screenshot of the newly created PDF file sample.pdf by the above code: class="content-img-align-center"> class="center-image-wrapper"> 我们可以看到,在使用 IronPDF 创建 PDF 文件时,使用直观的语言处理页眉和页脚是多么简单。 现在,我们将看看如何使用 PrizmDoc Viewer 设置页眉和页脚。 6.2. PrizmDoc Viewer PDF 页眉和页脚 PrizmDoc Viewer 提供 HeaderFooterOptions 类来处理页眉和页脚,具有以下属性: Lines 指定页眉和页脚的行(理解以下示例后会更清楚),每行具有以下属性: Left 在页眉或页脚的行的左侧打印文本: Center 在页眉或页脚的行的中间打印文本: Right 在页眉或页脚的行的右侧打印文本: FontFamily 指定页眉或页脚文本的字体族。 FontSize 指定页眉或页脚的字体大小。 Color 指定页眉或页脚文本的颜色。 阅读更多 关于如何使用 PrizmDoc 服务器的 PDF 页眉和页脚。 让我们看看如何使用以上属性实现我们的用例。 using System.Threading.Tasks; using System.Collections.Generic; using Accusoft.PrizmDocServer; using Accusoft.PrizmDocServer.Conversion; static void Main(string[] args) { SetHeaderFooter().GetAwaiter().GetResult(); } private static async Task SetHeaderFooter() { // Instantiate PrizmDocServerClient object with Header and footer properties var prizmDocServer = new PrizmDocServerClient("https://api.accusoft.com", "Your-API-KEY"); ConversionResult result = await prizmDocServer.ConvertToPdfAsync( "myWebPage.html", header: new HeaderFooterOptions { Lines = new List<HeaderFooterLine> { new HeaderFooterLine { Left = "Page Title", Right = DateTime.Now.ToString() } }, }, footer: new HeaderFooterOptions { Lines = new List<HeaderFooterLine> { new HeaderFooterLine { Right = "Page {{pageNumber}} of {{pageCount}}" }, }, }); // Save to the target location await result.RemoteWorkFile.SaveAsync("sample.pdf"); } using System.Threading.Tasks; using System.Collections.Generic; using Accusoft.PrizmDocServer; using Accusoft.PrizmDocServer.Conversion; static void Main(string[] args) { SetHeaderFooter().GetAwaiter().GetResult(); } private static async Task SetHeaderFooter() { // Instantiate PrizmDocServerClient object with Header and footer properties var prizmDocServer = new PrizmDocServerClient("https://api.accusoft.com", "Your-API-KEY"); ConversionResult result = await prizmDocServer.ConvertToPdfAsync( "myWebPage.html", header: new HeaderFooterOptions { Lines = new List<HeaderFooterLine> { new HeaderFooterLine { Left = "Page Title", Right = DateTime.Now.ToString() } }, }, footer: new HeaderFooterOptions { Lines = new List<HeaderFooterLine> { new HeaderFooterLine { Right = "Page {{pageNumber}} of {{pageCount}}" }, }, }); // Save to the target location await result.RemoteWorkFile.SaveAsync("sample.pdf"); } Imports System.Threading.Tasks Imports System.Collections.Generic Imports Accusoft.PrizmDocServer Imports Accusoft.PrizmDocServer.Conversion Shared Sub Main(ByVal args() As String) SetHeaderFooter().GetAwaiter().GetResult() End Sub Private Shared Async Function SetHeaderFooter() As Task ' Instantiate PrizmDocServerClient object with Header and footer properties Dim prizmDocServer = New PrizmDocServerClient("https://api.accusoft.com", "Your-API-KEY") Dim result As ConversionResult = Await prizmDocServer.ConvertToPdfAsync("myWebPage.html", header:= New HeaderFooterOptions With {.Lines = New List(Of HeaderFooterLine) _ From { New HeaderFooterLine With { .Left = "Page Title", .Right = DateTime.Now.ToString() } } }, footer:= New HeaderFooterOptions With { .Lines = New List(Of HeaderFooterLine) From { New HeaderFooterLine With {.Right = "Page {{pageNumber}} of {{pageCount}}"} } }) ' Save to the target location Await result.RemoteWorkFile.SaveAsync("sample.pdf") End Function $vbLabelText $csharpLabel 输出: 新创建的 PDF 文件的截图: class="content-img-align-center"> class="center-image-wrapper"> 6.3. PDF 页眉和页脚代码比较 我们可以看到,IronPDF 提供了更多的功能来设置页眉和页脚属性,且编程结构比 PrizmDoc Viewer 简单。 还建议使用 IronPDF 生成的 PDF 文件比 PrizmDoc Viewer 生成的文件更可读和更具吸引力。 7. 将 PDF 页面转换为图像 让我们再进行一个用例:我们有一个简单的 PDF 文件名为 Sample_PDF.pdf,其中仅有 2 页。 Page1 Page2 class="center-image-wrapper"> class="center-image-wrapper"> 我们需要为每一页创建一个图像。 首先,我们将看看如何使用 IronPDF 执行此任务。 7.1. IronPDF 将 PDF 转换为图像 using IronPdf; static void Main(string[] args) { // Specify file to be converted var pdf = PdfDocument.FromFile("Sample_PDF.pdf"); // Save images to the target location pdf.RasterizeToImageFiles("image_*.png"); } using IronPdf; static void Main(string[] args) { // Specify file to be converted var pdf = PdfDocument.FromFile("Sample_PDF.pdf"); // Save images to the target location pdf.RasterizeToImageFiles("image_*.png"); } Imports IronPdf Shared Sub Main(ByVal args() As String) ' Specify file to be converted Dim pdf = PdfDocument.FromFile("Sample_PDF.pdf") ' Save images to the target location pdf.RasterizeToImageFiles("image_*.png") End Sub $vbLabelText $csharpLabel 输出: 上述代码将创建以下两个 .png 图像: Page1 Image Page2 Image class="center-image-wrapper"> class="center-image-wrapper"> 我们可以看到使用 IronPDF 创建每个 PDF 页面的图像是多么简单。 现在,我们将使用 PrizmDoc Viewer 执行相同的任务。 7.2. PrizmDoc Viewer PDF 到图像 using System.Linq; using System.Collections.Generic; using System.Threading.Tasks; using Accusoft.PrizmDocServer; using Accusoft.PrizmDocServer.Conversion; static void Main(string[] args) { PdfToImage().GetAwaiter().GetResult(); } private static async Task PdfToImage() { // Instantiate PrizmDocServerClient object var prizmDocServer = new PrizmDocServerClient("https://api.accusoft.com", "Your-API-KEY"); // Convert PDF file to images IEnumerable<ConversionResult> results = await prizmDocServer.ConvertAsync("Sample_PDF.pdf", DestinationFileFormat.Png); // Save each image. for (int i = 0; i < results.Count(); i++) { await results.ElementAt(i).RemoteWorkFile.SaveAsync($"page-{i + 1}.png"); } } using System.Linq; using System.Collections.Generic; using System.Threading.Tasks; using Accusoft.PrizmDocServer; using Accusoft.PrizmDocServer.Conversion; static void Main(string[] args) { PdfToImage().GetAwaiter().GetResult(); } private static async Task PdfToImage() { // Instantiate PrizmDocServerClient object var prizmDocServer = new PrizmDocServerClient("https://api.accusoft.com", "Your-API-KEY"); // Convert PDF file to images IEnumerable<ConversionResult> results = await prizmDocServer.ConvertAsync("Sample_PDF.pdf", DestinationFileFormat.Png); // Save each image. for (int i = 0; i < results.Count(); i++) { await results.ElementAt(i).RemoteWorkFile.SaveAsync($"page-{i + 1}.png"); } } Imports System.Linq Imports System.Collections.Generic Imports System.Threading.Tasks Imports Accusoft.PrizmDocServer Imports Accusoft.PrizmDocServer.Conversion Shared Sub Main(ByVal args() As String) PdfToImage().GetAwaiter().GetResult() End Sub Private Shared Async Function PdfToImage() As Task ' Instantiate PrizmDocServerClient object Dim prizmDocServer = New PrizmDocServerClient("https://api.accusoft.com", "Your-API-KEY") ' Convert PDF file to images Dim results As IEnumerable(Of ConversionResult) = Await prizmDocServer.ConvertAsync("Sample_PDF.pdf", DestinationFileFormat.Png) ' Save each image. For i As Integer = 0 To results.Count() - 1 Await results.ElementAt(i).RemoteWorkFile.SaveAsync($"page-{i + 1}.png") Next i End Function $vbLabelText $csharpLabel 输出: 上述代码也将创建以下两个 .png 图像: Page1 Page2 class="center-image-wrapper"> class="center-image-wrapper"> 7.3. PDF 到图像代码比较 与 PrizmDoc Viewer 比较,使用 IronPDF 即使不需要迭代页面,也可以轻松创建每页的图像,且代码行数最少。 为数据表使用 Bootstrap 5 与 IronPDF IronPDF 的 Chrome V8 渲染引擎为 Bootstrap 5 数据表提供了卓越的支持,使您能够生成具有复杂表格布局的专业 PDF 报告。 此示例演示了渐变标题、状态徽章、分页控件和摘要指标 - 展示了 IronPDF 相对于传统 PDF 查看器如 PrizmDoc 的优势。 using IronPdf; var renderer = new ChromePdfRenderer(); string dataTableReport = @" <!DOCTYPE html> <html> <head> <meta charset='utf-8'> <link href='https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css' rel='stylesheet'> <style> .table-header { background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); color: white; padding: 30px; border-radius: 10px 10px 0 0; } .table-container { background: white; border-radius: 0 0 10px 10px; box-shadow: 0 10px 30px rgba(0,0,0,0.1); overflow: hidden; } .table th { background: #f8f9fa; font-weight: 600; text-transform: uppercase; font-size: 0.85rem; letter-spacing: 0.5px; } .status-badge { padding: 0.35em 0.65em; border-radius: 0.25rem; font-weight: 600; font-size: 0.75rem; } .trend-positive { color: #198754; font-weight: 700; } .trend-negative { color: #dc3545; font-weight: 700; } @media print { .table-container { page-break-inside: avoid; } } </style> </head> <body class='bg-light'> <div class='container py-5'> <div class='table-container'> <div class='table-header'> <div class='row align-items-center'> <div class='col-md-8'> <h2 class='mb-2'>Sales Performance Report</h2> <p class='mb-0 opacity-75'>Q4 2024 Regional Analysis</p> </div> <div class='col-md-4 text-end'> <div class='btn-group btn-group-sm'> <button class='btn btn-light'>Export</button> <button class='btn btn-light'>Filter</button> <button class='btn btn-light'>Sort</button> </div> </div> </div> </div> <div class='p-4'> <div class='row mb-3'> <div class='col-md-4'> <input type='text' class='form-control form-control-sm' placeholder='Search regions...'> </div> <div class='col-md-8 text-end'> <span class='text-muted small'>Showing 1-10 of 48 results</span> </div> </div> <div class='table-responsive'> <table class='table table-hover align-middle'> <thead> <tr> <th>Region</th> <th>Revenue</th> <th>Units Sold</th> <th>Growth</th> <th>Status</th> <th>Action</th> </tr> </thead> <tbody> <tr> <td> <strong>North America</strong><br> <small class='text-muted'>USA, Canada, Mexico</small> </td> <td>$4,280,000</td> <td>12,450</td> <td><span class='trend-positive'>↑ 18.5%</span></td> <td><span class='status-badge bg-success text-white'>Exceeding</span></td> <td><button class='btn btn-sm btn-outline-primary'>Details</button></td> </tr> <tr> <td> <strong>Europe</strong><br> <small class='text-muted'>EU, UK, Switzerland</small> </td> <td>$3,650,000</td> <td>10,890</td> <td><span class='trend-positive'>↑ 12.3%</span></td> <td><span class='status-badge bg-success text-white'>On Track</span></td> <td><button class='btn btn-sm btn-outline-primary'>Details</button></td> </tr> <tr> <td> <strong>Asia Pacific</strong><br> <small class='text-muted'>Japan, Australia, Singapore</small> </td> <td>$2,940,000</td> <td>8,320</td> <td><span class='trend-positive'>↑ 24.7%</span></td> <td><span class='status-badge bg-primary text-white'>Growing</span></td> <td><button class='btn btn-sm btn-outline-primary'>Details</button></td> </tr> <tr> <td> <strong>Latin America</strong><br> <small class='text-muted'>Brazil, Argentina, Chile</small> </td> <td>$1,580,000</td> <td>4,670</td> <td><span class='trend-positive'>↑ 8.9%</span></td> <td><span class='status-badge bg-info text-white'>Stable</span></td> <td><button class='btn btn-sm btn-outline-primary'>Details</button></td> </tr> <tr> <td> <strong>Middle East</strong><br> <small class='text-muted'>UAE, Saudi Arabia, Israel</small> </td> <td>$980,000</td> <td>2,890</td> <td><span class='trend-negative'>↓ 3.2%</span></td> <td><span class='status-badge bg-warning text-dark'>Review</span></td> <td><button class='btn btn-sm btn-outline-primary'>Details</button></td> </tr> </tbody> <tfoot class='table-light'> <tr> <td><strong>Total</strong></td> <td><strong>$13,430,000</strong></td> <td><strong>39,220</strong></td> <td><strong class='trend-positive'>↑ 14.8%</strong></td> <td colspan='2'></td> </tr> </tfoot> </table> </div> <div class='d-flex justify-content-between align-items-center mt-4'> <div> <select class='form-select form-select-sm' style='width: auto; display: inline-block;'> <option>10 per page</option> <option>25 per page</option> <option>50 per page</option> </select> </div> <nav> <ul class='pagination pagination-sm mb-0'> <li class='page-item disabled'><a class='page-link' href='#'>Previous</a></li> <li class='page-item active'><a class='page-link' href='#'>1</a></li> <li class='page-item'><a class='page-link' href='#'>2</a></li> <li class='page-item'><a class='page-link' href='#'>3</a></li> <li class='page-item'><a class='page-link' href='#'>Next</a></li> </ul> </nav> </div> </div> </div> <div class='row g-3 mt-4'> <div class='col-md-3'> <div class='card text-center'> <div class='card-body'> <h3 class='text-primary mb-1'>$13.4M</h3> <small class='text-muted'>Total Revenue</small> </div> </div> </div> <div class='col-md-3'> <div class='card text-center'> <div class='card-body'> <h3 class='text-success mb-1'>39,220</h3> <small class='text-muted'>Units Sold</small> </div> </div> </div> <div class='col-md-3'> <div class='card text-center'> <div class='card-body'> <h3 class='text-info mb-1'>14.8%</h3> <small class='text-muted'>Growth Rate</small> </div> </div> </div> <div class='col-md-3'> <div class='card text-center'> <div class='card-body'> <h3 class='text-warning mb-1'>5</h3> <small class='text-muted'>Active Regions</small> </div> </div> </div> </div> </div> </body> </html>"; var pdf = renderer.RenderHtmlAsPdf(dataTableReport); pdf.SaveAs("data-table-report.pdf"); using IronPdf; var renderer = new ChromePdfRenderer(); string dataTableReport = @" <!DOCTYPE html> <html> <head> <meta charset='utf-8'> <link href='https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css' rel='stylesheet'> <style> .table-header { background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); color: white; padding: 30px; border-radius: 10px 10px 0 0; } .table-container { background: white; border-radius: 0 0 10px 10px; box-shadow: 0 10px 30px rgba(0,0,0,0.1); overflow: hidden; } .table th { background: #f8f9fa; font-weight: 600; text-transform: uppercase; font-size: 0.85rem; letter-spacing: 0.5px; } .status-badge { padding: 0.35em 0.65em; border-radius: 0.25rem; font-weight: 600; font-size: 0.75rem; } .trend-positive { color: #198754; font-weight: 700; } .trend-negative { color: #dc3545; font-weight: 700; } @media print { .table-container { page-break-inside: avoid; } } </style> </head> <body class='bg-light'> <div class='container py-5'> <div class='table-container'> <div class='table-header'> <div class='row align-items-center'> <div class='col-md-8'> <h2 class='mb-2'>Sales Performance Report</h2> <p class='mb-0 opacity-75'>Q4 2024 Regional Analysis</p> </div> <div class='col-md-4 text-end'> <div class='btn-group btn-group-sm'> <button class='btn btn-light'>Export</button> <button class='btn btn-light'>Filter</button> <button class='btn btn-light'>Sort</button> </div> </div> </div> </div> <div class='p-4'> <div class='row mb-3'> <div class='col-md-4'> <input type='text' class='form-control form-control-sm' placeholder='Search regions...'> </div> <div class='col-md-8 text-end'> <span class='text-muted small'>Showing 1-10 of 48 results</span> </div> </div> <div class='table-responsive'> <table class='table table-hover align-middle'> <thead> <tr> <th>Region</th> <th>Revenue</th> <th>Units Sold</th> <th>Growth</th> <th>Status</th> <th>Action</th> </tr> </thead> <tbody> <tr> <td> <strong>North America</strong><br> <small class='text-muted'>USA, Canada, Mexico</small> </td> <td>$4,280,000</td> <td>12,450</td> <td><span class='trend-positive'>↑ 18.5%</span></td> <td><span class='status-badge bg-success text-white'>Exceeding</span></td> <td><button class='btn btn-sm btn-outline-primary'>Details</button></td> </tr> <tr> <td> <strong>Europe</strong><br> <small class='text-muted'>EU, UK, Switzerland</small> </td> <td>$3,650,000</td> <td>10,890</td> <td><span class='trend-positive'>↑ 12.3%</span></td> <td><span class='status-badge bg-success text-white'>On Track</span></td> <td><button class='btn btn-sm btn-outline-primary'>Details</button></td> </tr> <tr> <td> <strong>Asia Pacific</strong><br> <small class='text-muted'>Japan, Australia, Singapore</small> </td> <td>$2,940,000</td> <td>8,320</td> <td><span class='trend-positive'>↑ 24.7%</span></td> <td><span class='status-badge bg-primary text-white'>Growing</span></td> <td><button class='btn btn-sm btn-outline-primary'>Details</button></td> </tr> <tr> <td> <strong>Latin America</strong><br> <small class='text-muted'>Brazil, Argentina, Chile</small> </td> <td>$1,580,000</td> <td>4,670</td> <td><span class='trend-positive'>↑ 8.9%</span></td> <td><span class='status-badge bg-info text-white'>Stable</span></td> <td><button class='btn btn-sm btn-outline-primary'>Details</button></td> </tr> <tr> <td> <strong>Middle East</strong><br> <small class='text-muted'>UAE, Saudi Arabia, Israel</small> </td> <td>$980,000</td> <td>2,890</td> <td><span class='trend-negative'>↓ 3.2%</span></td> <td><span class='status-badge bg-warning text-dark'>Review</span></td> <td><button class='btn btn-sm btn-outline-primary'>Details</button></td> </tr> </tbody> <tfoot class='table-light'> <tr> <td><strong>Total</strong></td> <td><strong>$13,430,000</strong></td> <td><strong>39,220</strong></td> <td><strong class='trend-positive'>↑ 14.8%</strong></td> <td colspan='2'></td> </tr> </tfoot> </table> </div> <div class='d-flex justify-content-between align-items-center mt-4'> <div> <select class='form-select form-select-sm' style='width: auto; display: inline-block;'> <option>10 per page</option> <option>25 per page</option> <option>50 per page</option> </select> </div> <nav> <ul class='pagination pagination-sm mb-0'> <li class='page-item disabled'><a class='page-link' href='#'>Previous</a></li> <li class='page-item active'><a class='page-link' href='#'>1</a></li> <li class='page-item'><a class='page-link' href='#'>2</a></li> <li class='page-item'><a class='page-link' href='#'>3</a></li> <li class='page-item'><a class='page-link' href='#'>Next</a></li> </ul> </nav> </div> </div> </div> <div class='row g-3 mt-4'> <div class='col-md-3'> <div class='card text-center'> <div class='card-body'> <h3 class='text-primary mb-1'>$13.4M</h3> <small class='text-muted'>Total Revenue</small> </div> </div> </div> <div class='col-md-3'> <div class='card text-center'> <div class='card-body'> <h3 class='text-success mb-1'>39,220</h3> <small class='text-muted'>Units Sold</small> </div> </div> </div> <div class='col-md-3'> <div class='card text-center'> <div class='card-body'> <h3 class='text-info mb-1'>14.8%</h3> <small class='text-muted'>Growth Rate</small> </div> </div> </div> <div class='col-md-3'> <div class='card text-center'> <div class='card-body'> <h3 class='text-warning mb-1'>5</h3> <small class='text-muted'>Active Regions</small> </div> </div> </div> </div> </div> </body> </html>"; var pdf = renderer.RenderHtmlAsPdf(dataTableReport); pdf.SaveAs("data-table-report.pdf"); IRON VB CONVERTER ERROR developers@ironsoftware.com $vbLabelText $csharpLabel 此代码生成带有渐变标题、响应式表格、状态徽章和摘要指标的复杂数据表报告。 IronPDF 的 Chrome 渲染引擎保留了所有 Bootstrap 样式,包括表格悬停效果、徽章颜色和分页控件 - 这些功能远远超出传统 PDF 查看器的能力。 相对于 PrizmDoc Viewer 的主要优势: 直接 HTML 表格渲染,无需转换 完整的 Bootstrap 组件支持 渐变背景和现代 CSS 具有适当分页的响应式表格布局 有关 Bootstrap PDF 生成的更多详细信息,请参见 HTML 到 PDF Bootstrap 指南。 8. 许可证定价 在上述比较中,我们看到了这两个组件的技术工作结构和提供的功能。 现在我们将看看这两个组件的许可证定价。 这非常重要,因为我们总是尽力使用最低预算来满足我们的要求。 8.1. IronPDF 许可证选项 IronPDF 授權從 $699 起,用於單個項目和一位開發者使用。 如果您是在公司或代理機構中為多個客戶提供服務的工程師,授權起價為 $699,可以根據團隊規模和項目數量進行調整。 以下授權僅需一次性付款。 開發人員數量 價格 1-5 9 6-10 9 11-20 9 21-50 $1,199 無限 ,199 對於擁有多個地點的公司,授權從 $1199 起。 對於 SaaS 服務,授權從 $1099 起。 對於免版稅的 OEM 重新分發,授權從 $1599 起。 注意: 所有以上授權包均包含 1 年的支持和更新。 了解更多 有關 IronPDF 的所有提供的授權包。 8.2. PrizmDoc Viewer 授權選項 自託管選項 如果您管理自己的伺服器,則授權價格為 $7,900/年 並包含標準支持。 了解更多 有關 PrizmDoc Viewer 的所有提供的包信息。 基於雲的選項 此授權適用於 PrizmDoc Viewer 的基於雲的服務,是根據交易數量的基礎進行擴展的。 術語: 交易 意味著我們訪問 PrizmDoc Viewer 伺服器並獲得輸出(生成的文件)。 預付磅 意味著您一次性支付獲得不會過期的交易。 交易數量 預付磅 每月 每年 200 1,000 2,000 9 6,000 4 9 ,859 (6,000 交易/月) 12,000 4 9 ,179 (12,000 交易/月) 25,000 9 9 ,459 (25,000 交易/月) 50,000 ,199 9 ,789 (50,000 交易/月) 100,000 $1,199 $1,199 ,989 (100,000 交易/月) 200,000 ,549 ,699 ,188 (200,000 交易/月) 300,000 ,299 ,199 ,188 (300,000 交易/月 400,000 ,049 ,699 ,188 (400,000 交易/月) 500,000 ,799 ,199 ,188 (500,000 交易/月) class="tutorial-segment-title">快速教程訪問 class="tutorial-section"> class="row"> class="col-sm-4"> class="tutorial-image"> 快速教程訪問" class="img-responsive add-shadow img-responsive img-popup" src="/img/svgs/html-to-pdf-icon.svg" loading="lazy"> class="col-sm-8"> 獲取 C# IronPDF 快速入門手冊 我們創建了一本免費的 PDF 資源指南,幫助 .NET 開發更簡單,提供常見功能的步驟介紹,以及在 C# 和 VB.NET 中操作、編輯、生成和保存 PDF 的示例。 下載指南 class="tutorial-section"> class="row"> class="col-sm-8"> 探索 IronPDF API 參考 探索 IronPDF C# 庫的 API 參考,包含所有 IronPDF 的功能、類別、方法欄位、命名空間和枚舉的詳細信息。 查看API參考 class="col-sm-4"> class="tutorial-image"> 快速教程訪問" class="img-responsive add-shadow img-responsive img-popup" src="/img/svgs/documentation.svg" loading="lazy"> 請注意Accusoft 的 PrizmDoc Viewer 是其各自所有者的註冊商標。 本網站與 Accusoft 的 PrizmDoc Viewer 無關,未經其授權或贊助。 所有產品名稱、徽標和品牌均為其各自所有者的財產。 比較僅供信息參考,並反映撰寫時公開可用的信息。 常見問題解答 如何在C#中將HTML轉換為PDF? 您可以使用 IronPDF 的RenderHtmlAsPdf方法將 HTML 字串轉換為 PDF。您也可以使用RenderHtmlFileAsPdf將 HTML 檔案轉換為 PDF。 與 PrizmDoc Viewer 相比,使用 IronPDF 進行 PDF 轉換有哪些優點? IronPDF 提供了一個簡單易用的本機 PDF 渲染解決方案,支援離線工作,無需非同步程式設計。相較之下,PrizmDoc Viewer 透過 REST API 運行,需要連接網路才能與遠端伺服器互動。 我可以使用 PDF 庫合併多個 PDF 文件嗎? 是的,使用 IronPDF,您可以使用MergePdf方法合併多個 PDF 文件,從而實現文件的無縫合併。 IronPDF 如何處理 PDF 到影像的轉換? IronPDF 讓您可以使用其內建方法輕鬆地將 PDF 頁面轉換為圖像,與其他軟體相比,它提供了一種簡化的方法。 IronPDF 中有哪些頁首和頁尾自訂選項? IronPDF 提供豐富的功能來設定頁首和頁尾屬性,程式設計結構簡單,讓您可以輕鬆自訂文件。 IronPDF 是否適用於離線 PDF 處理? 是的,IronPDF 支援離線 PDF 處理,這意味著您可以無需網路連線即可運作,這與其他一些需要遠端伺服器互動的解決方案不同。 IronPDF許可證的費用結構是怎麼樣的? IronPDF 許可證起價為 699 美元,適用於單一專案和一名開發人員,並為公司和 SaaS 服務提供可擴展選項,提供經濟高效的一次性付款解決方案。 我可以免費使用 IronPDF 進行開發嗎? 是的,IronPDF 可免費用於開發,沒有時間限制,並提供 30 天的部署試用期,讓您立即上線專案。 PrizmDoc Viewer 如何處理 HTML 到 PDF 的轉換? PrizmDoc Viewer 使用 REST API 進行 HTML 到 PDF 的轉換,需要非同步程式設計和網路連線才能進行遠端伺服器互動。 運行 PrizmDoc 伺服器需要哪些系統需求? 自託管 PrizmDoc 伺服器至少需要 32 GB 記憶體和 4 核心 CPU,以滿足其處理需求。 IronPDF 是否完全相容於 .NET 10? 是的。 IronPDF 支援 .NET 10(以及 .NET 9、8、7、6、.NET Core、.NET Standard 和 .NET Framework)。它透過 NuGet 安裝,可在 Windows、Linux 和 macOS 上運行,並使用其基於 Chrome 的原生渲染器,在 .NET 10 應用程式中提供像素級精確的 HTML 轉 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。 閱讀更多 PDFSharp HTML轉PDF範例及教程比較IronPDF 和 PDFCrowd 的比較
發表日期 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。 閱讀更多