跳至页脚内容
产品比较

IronPDF 与 Accusoft PDF Viewer:哪个 C# 库最适合 HTML 转 PDF?

IronPDF 和 Accusoft PDF Viewer 都是在 .NET 环境下将HTML 转换为 PDF 的软件。 IronPDF 提供简洁易懂的语法、无需云端依赖的本地处理以及无限次转换,起价 699 美元。相比之下,Accusoft 需要互联网连接,并按交易次数收费。

比较 IronPDF 与 Accusoft PDF Viewer

  • 将 HTML 转换为 PDF
  • 为 PDF 文件设置页眉和页脚
  • 将 PDF 转换为图像文件
  • 比较许可、免费试用选项等

概述

IronPDF是什么?它是如何工作的?

IronPDF是一个C# HTML 转 PDF 库,它使开发人员能够从HTML 字符串网页URL源创建 PDF 文件。 它还允许设置水印书签页眉和页脚等属性。 此外,开发人员可以使用图像转 PDF 功能将多个 PDF 文件合并为一个文件,或将PDF 页面转换为图像,反之亦然。

IronPDF对开发用户免费,并为实际项目提供30 天的部署试用期。 它提供完整的文档代码示例API 参考,帮助开发者快速入门。

Developers can download a file project from this link.

What Is Accusoft `PrizmDoc` Viewer and How Does It Work?

PrizmDoc Viewer是一个 REST API,可以处理PDF 文件并将其远程转换为其他格式。 PrizmDoc可以将 100 多种不同的文件格式转换为 PDF,并将 PDF 转换为PNG、JPGTIFF和 SVG。 它还为应用程序提供多种电子签名选项

How Do IronPDF and `PrizmDoc` Viewer Compare?

IronPDF `PrizmDoc` Viewer
Work with [PDF files programmatically](/how-to/csharp-parse-pdf/). 以编程方式处理 PDF 文件。
Supports [.NET Core](/docs/) with [Windows](/get-started/windows/), [Mac](/get-started/macos/), or [Linux](/get-started/linux/). 支持使用 Windows、Mac 或 Linux 的 .NET Core。
[Works Locally](/get-started/installation-overview/) Sends Documents to a [remote server](/get-started/ironpdfengine/).
Work with or without [Asynchronous Programming](/how-to/async/). Must use Asynchronous Programming with `System.Threading.Tasks`.
Works offline once [installed](/get-started/installation-overview/). Requires internet connection for `PrizmDoc` server requests.
Provides many [predefined functions](/features/). 提供一些预定义的功能。
Often requires [minimal lines of code](/tutorials/html-to-pdf/). 通常需要许多行代码。
[无限 conversions](/licensing/) per project in each license. 云端托管许可证的交易量有限。
[Free for development](/get-started/quickstart/) without time limits. 仅有 300 笔交易可试用。

我们来安装这两个库,然后比较一下代码。


第 1 步:安装

如何在我的.NET项目中安装IronPDF?

在项目中安装 IronPDF有两种方法,两种方法之间没有任何区别。 IronPDF 支持多种环境,包括Azure 部署AWS LambdaDocker 容器Blazor 应用程序

下载 IronPDF 有哪些不同的方法?

下载 IronPDF.dll并将其引用添加到项目中。 开发人员还可以使用Windows Installer进行系统级安装。 此后,即可使用以下方式访问 IronPdf 命名空间:

using IronPdf;
using IronPdf;
$vbLabelText   $csharpLabel

现在,开发人员可以轻松访问 IronPDF 提供的函数和类,包括用于渲染、 PDF 文档操作安全功能的ChromePdfRenderer

如何通过 NuGet 包管理器安装 IronPDF?


How Do I Install `PrizmDoc` Viewer from Accusoft?

PrizmDoc Viewer 由两部分组成:服务器端组件PrizmDoc Server (作为 RESTful API 运行)和客户端项目(向 API 发送请求并接收响应)。 与无需外部依赖即可在本地运行的 IronPDF 不同, PrizmDoc需要网络连接才能进行基于云的操作。

How Can I Access the `PrizmDoc` Server?

PrizmDoc Server 是一个服务器端应用程序,它接收包含文档的基本信息作为请求(输入),并将文档转换为PDF 文件,然后将转换后的 PDF 文件作为响应(输出)发送回去。 它是产品的技术核心——一个文档处理和转换引擎。开发人员可以通过两种不同的方法使用它,这两种方法都具有相同的编程结构和技术:

1.自行托管:

此选项需要安排服务器。 下载 PrizmDoc 服务器并安装。 阅读更多关于如何在Windows上安装PrizmDoc服务器的信息。

注意:为了获得更好的性能,需要至少 32 GB 内存和 4 核 CPU。 相比之下, IronPDF 的系统要求要低得多。

2.云托管:

这项基于云的服务省去了部署服务器的麻烦。 要使用此选项,请创建一个帐户,然后从主页上的API Key菜单复制API key

首先,让我们来了解一下使用PrizmDoc Viewer 将文档转换为 PDF 文件的基本结构,方法是在 C# 控制台应用程序中使用WebClient()直接与Accusoft server交互。

注:以下示例演示了PrizmDoc如何处理 PDF 文件。 篇幅较长,您可以跳过此示例,直接进行比较

Accusoft 的工作结构是如何运作的?

此示例将myWebpage.html转换为sample.pdf 。 与IronPDF 直接的 HTML 转 PDF 转换不同, PrizmDoc需要多次 API 调用。

注意:必须安装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
$vbLabelText   $csharpLabel

然后创建一个名为Accusoft API Key公共变量,并将 API 密钥粘贴到该变量中:

static string ApiKey = "Your-API-KEY";
static string ApiKey = "Your-API-KEY";
$vbLabelText   $csharpLabel

使用PrizmDoc Viewer 处理 PDF 文件需要 3 个步骤:

  1. 将文件上传到PrizmDoc服务器。 2.转换上传的文件。
  2. 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();
}
$vbLabelText   $csharpLabel

1.将文件上传到服务器: 2.

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("___PROTECTED_URL_123___");
    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("___PROTECTED_URL_123___");
    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);
        }
    }
}
$vbLabelText   $csharpLabel

2.将上传的文件转换为 PDF:

public static async Task<JObject> Convert(string affinityToken, string fileID)
{
    var endpoint = new Uri("___PROTECTED_URL_124___");
    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("___PROTECTED_URL_124___");
    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);
    }
}
$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 = "___PROTECTED_URL_125___" + 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 = "___PROTECTED_URL_125___" + 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);
    }
}
$vbLabelText   $csharpLabel

3.从服务器下载转换后的文件

public static async Task DownloadFromServer(string affinityToken, string fileId, string outfile)
{
    var endpoint = new Uri("___PROTECTED_URL_126___" + 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("___PROTECTED_URL_126___" + 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);
        }
    }
}
$vbLabelText   $csharpLabel

上述例子需要付出大量努力。 为了最大限度地减少工作量,Accusoft 推出了一个名为Accusoft.PrizmDocServerSDK的 .NET 库,它是PrizmDoc Server REST API 的封装器。 让我们来看看如何在 .NET 项目中安装和使用这个库。

How Do I Install Accusoft.`PrizmDocServer`SDK?

有两种安装包装器的方法。

  • 软件包管理器控制台:

    如果使用程序包管理器控制台,请运行以下命令:

    _CODEBLOCK10

  • 管理解决方案的软件包:

    如果使用 NuGet 程序包管理器 GUI,请在搜索栏中浏览Accusoft.PrizmDocServerSDK并进行安装。

现在,开发人员可以轻松访问Accusoft.PrizmDocServer命名空间并使用它:

using Accusoft.PrizmDocServer;
using Accusoft.PrizmDocServer;
$vbLabelText   $csharpLabel

教程

IronPDF 和PrizmDoc Viewer 在代码示例中有何异同?

在回顾了两个组件的介绍和安装之后,现在是时候使用它们了。 以下用例演示了如何使用这两个组件进行实现,以帮助理解编程结构并确定哪个组件最符合项目要求。


如何使用 IronPDF 和PrizmDoc Viewer 将 HTML 转换为 PDF?

为了进行比较,我们将名为myWebPage.html的网页转换为PDF 文件并将其保存到目标位置。 IronPDF 的Chrome 渲染引擎提供像素级完美转换,并完全支持CSSJavaScriptWeb 字体

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");
}
$vbLabelText   $csharpLabel

上述代码创建一个名为sample.pdf文件,并将其保存到项目的bin&gt;debug文件夹中。 IronPDF 还支持HTML 字符串URL ,甚至包含 HTML 的 ZIP 文件作为输入源。

开发人员还可以指定任意路径,例如: PDF.SaveAs(&quot;E:/sample.pdf&quot;);或者保存到内存流以进行云部署。

阅读更多关于使用 IronPDF 处理 PDF 文件的信息。

现在,让我们使用PrizmDoc Viewer 执行相同的任务进行比较。

PrizmDoc Viewer 如何将 HTML 转换为 PDF?

PrizmDoc Viewer 安装部分,讨论了如何获取Accusoft API Key 。 使用方法如下。

首先,向PrizmDoc服务器发送请求并接收响应。 这个过程需要时间,因此需要异步编程。 IronPDF 还支持异步方法,以提高性能。

注意:使用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("___PROTECTED_URL_127___", "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("___PROTECTED_URL_127___", "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");
}
$vbLabelText   $csharpLabel

阅读更多关于使用PrizmDoc Viewer 的信息。

哪个库提供更简单的 HTML 转 PDF 转换?

这些示例表明,IronPDF 提供了一种更简便的 PDF 文件创建方法,并且耗时更短。IronPDF 还提供多种渲染选项,用于微调输出,包括自定义纸张尺寸边距视口设置


如何使用 IronPDF 和PrizmDoc Viewer 将图像转换为 PDF?

此对比演示了如何从位于项目debug文件夹中的图像创建 PDF 文件。 开发者们首先会使用 IronPDF。

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");
}
$vbLabelText   $csharpLabel

IronPDF 还支持多帧 TIFF 转换嵌入 Azure Blob 存储中的图像以及Base64 图像嵌入

输出:

此屏幕截图显示了使用上述代码新创建的 PDF 文件sample.pdf

一份PDF文档,其中谷歌徽标居中显示在白色背景上,演示了IronPDF的图像转PDF功能。

使用 IronPDF 从图像创建 PDF 文件非常简单。 现在,让我们使用PrizmDoc Viewer 执行相同的任务,并检查其生成的 PDF 文件。

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("___PROTECTED_URL_128___", "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("___PROTECTED_URL_128___", "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");
}
$vbLabelText   $csharpLabel

输出:此屏幕截图显示了上述代码新创建的 PDF 文件sample.pdf

PDF viewer displaying the Google logo on a gray background, showing `PrizmDoc`'s image conversion result

哪个库在图像转 PDF 转换方面需要的代码最少?

IronPDF 只需要两行代码。 相比之下,使用PrizmDoc服务器需要编写更多异步编程代码。 IronPDF 的输出还会自动提供一个可用的完整页面文档。 IronPDF 提供图像定位多图像转换等额外选项。


如何使用 IronPDF 和PrizmDoc Viewer 合并多个 PDF 文件?

为了进行比较,假设存在三个 PDF 文件,分别命名为A.pdfB.pdfC.pdf 。 任务是将它们合并成一个PDF文件。 这两个组件都能执行此任务。 首先,该示例展示了如何使用 IronPDF 执行此操作。

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();
    }
}
$vbLabelText   $csharpLabel

上述代码创建了一个sample.pdf文件,该文件合并了A.pdfB.pdfC.pdf 。 IronPDF 还支持在 PDF 之间添加和复制页面以及拆分 PDF

现在,让我们使用PrizmDoc Viewer 执行相同的任务。

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("___PROTECTED_URL_129___", "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("___PROTECTED_URL_129___", "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");
}
$vbLabelText   $csharpLabel

上述代码还会创建一个sample.pdf文件,该文件合并了A.pdfB.pdfC.pdf文件。


如何使用 IronPDF 和PrizmDoc Viewer 向 PDF 添加页眉和页脚?

为了进行比较,假设存在一个名为myWebPage.html的简单WebPage ,其 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

目标是将此WebPage转换为具有以下页眉和页脚属性的 PDF 文件:

  • 页眉左侧的Page Title
  • 标题右侧的 DateTime
  • 页脚右侧的Page Number of Total Pages

首先,我们来看看 IronPDF 是如何处理页眉和页脚的。

IronPDF 如何处理 PDF 的页眉和页脚?

为了处理 PDF 文件的页眉和页脚,IronPDF 在ChromePdfRenderer类中提供了一个名为RenderingOptions属性,其用法如下:

  • 供标题:

    _CODEBLOCK19

  • 页脚:

    _CODEBLOCK20

初始化TextHeaderFooter()时可以设置以下属性:

  • CenterText用于将文本打印在页眉或页脚的中央
  • LeftText用于在页眉或页脚左侧打印文本
  • RightText用于在页眉或页脚右侧打印文本
  • DrawDividerLine绘制一条线,将页面内容与页眉或页脚分隔开。
  • FontFamily用于指定页眉或页脚的字体系列
  • FontSize用于指定页眉或页脚的字体大小 *间距调整页面内容与页眉或页脚之间的空间

以下预定义属性有助于设置页眉或页脚内容。 它们用花括号{ }括起来:

  • {page}在页眉或页脚中打印当前页码
  • {total-pages}在页眉或页脚中打印总页数
  • {url}会打印渲染后页面的 URL
  • {date}在页眉或页脚中打印当前日期
  • {time}在页眉或页脚中打印当前时间
  • {html-title}在页眉或页脚中打印渲染后的网页标题
  • {pdf-title}在页眉或页脚中打印文档标题

阅读更多关于使用 IronPDF 处理页眉和页脚的详细信息。 IronPDF 还支持HTML 页眉和页脚,以适应更复杂的设计。

以下示例展示了如何实现上述用例并演示如何使用上述属性:

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");
}
$vbLabelText   $csharpLabel

输出:通过上述代码新创建的 PDF 文件 sample.pdf 的截图:

带有自定义页眉的 PDF 文档,显示

使用 IronPDF 处理页眉和页脚时,创建 PDF 文件会用到直观易懂的语言。 现在,该示例展示了PrizmDoc Viewer 如何处理页眉和页脚。

PrizmDoc Viewer 如何处理 PDF 的页眉和页脚?

PrizmDoc Viewer 提供了HeaderFooterOptions类来处理页眉和页脚,该类具有以下属性:

行数指定页眉和页脚的行数,每行具有以下属性: 左侧 表示在页眉或页脚行的左侧打印文本 居中 将文本打印在页眉或页脚行的中间。 表示在页眉或页脚行的右侧打印文本

  • FontFamily用于指定页眉或页脚文本的字体系列
  • FontSize用于指定页眉或页脚文本的字体大小 *颜色:指定页眉或页脚文本的颜色

阅读更多关于使用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("___PROTECTED_URL_130___", "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("___PROTECTED_URL_130___", "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");
}
$vbLabelText   $csharpLabel

输出:

以下是上述代码生成的PDF文件的屏幕截图:

PDF with header showing 'Page Title' and timestamp, comparing `PrizmDoc`'s header/footer implementation

哪个库在页眉和页脚方面提供了更大的灵活性?

PrizmDoc Viewer 相比,IronPDF 提供了更多设置页眉和页脚属性的功能,且编程结构更简单。 IronPDF 生成的 PDF 文件比PrizmDoc Viewer 生成的文件更易读、更美观。此外,IronPDF 还支持页码分页符,从而更好地控制文档。


## 如何使用 IronPDF 和PrizmDoc Viewer 将 PDF 页面转换为图像?

为了进行比较,我们假设你有一个名为Sample_PDF.pdf的简单 PDF 文件,其中包含两页。

第1页 第2页
PDF 查看器显示示例 PDF 的第一页,其中包含 Lorem ipsum 文本和标准查看器控件。
PDF 查看器显示示例 PDF 的第 2 页,其中包含 Lorem ipsum 文本和导航控件。

任务是为每一页创建图像。 首先,示例将展示如何使用 IronPDF 执行此操作。

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");
}
$vbLabelText   $csharpLabel

IronPDF 还支持将图像保存到内存流,并支持多种图像格式,包括 JPEG、TIFF 等。

输出:

以上代码会生成以下两个.png图像:

第 1 页 图片 第 2 页 图片
从 PDF 第 1 页生成的 PNG 图像,显示了虚拟力学教程内容,文本清晰可见。
从 PDF 第 2 页生成的 PNG 图像,显示了带有 IronPDF 栅格化质量的连续文本内容。

使用 IronPDF 创建 PDF 页面图像非常简单。 现在,让我们使用PrizmDoc Viewer 执行相同的任务。

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("___PROTECTED_URL_131___", "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("___PROTECTED_URL_131___", "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");
    }
}
$vbLabelText   $csharpLabel

输出:

上述代码还会生成以下两个.png图像:

第1页 第2页
PNG image generated from PDF page 1 using `PrizmDoc`'s conversion service with sample text content
PNG image generated from PDF page 2 showing `PrizmDoc`'s image conversion output quality

哪个库能让PDF转图像转换更轻松?

PrizmDoc Viewer 相比,IronPDF 允许开发人员使用最少的代码行轻松创建每一页的图像,即使不遍历页面也是如此。


我可以在 IronPDF 中使用 Bootstrap 5 数据表吗?

IronPDF 的Chrome V8 渲染引擎Bootstrap 5 数据表提供了出色的支持,使开发人员能够生成具有复杂表格布局的专业PDF 报告。 此示例演示了渐变标题、状态徽章、分页控件和摘要指标——这些功能突显了 IronPDF 相对于PrizmDoc等传统 PDF 查看器的优势。 IronPDF 完全支持现代 CSS 功能,包括flexbox 布局渐变响应式设计

using IronPdf;

var renderer = new ChromePdfRenderer();

string dataTableReport = @"
<!DOCTYPE html>
<html>
<head>
    <meta charset='utf-8'>
    <link href='___PROTECTED_URL_132___ 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='___PROTECTED_URL_132___ 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");
$vbLabelText   $csharpLabel

该代码会生成一份复杂的数据表格报告,其中包含渐变标题、响应式表格、状态徽章和汇总指标。 IronPDF 的 Chrome 渲染引擎保留了所有 Bootstrap 样式,包括表格悬停效果、徽章颜色和分页控件——这些功能超越了传统的 PDF 查看器。 该引擎还支持动态内容的JavaScript 渲染自定义字体UTF-8 国际字符

PrizmDoc Viewer 相比的主要优势:

有关 Bootstrap PDF 生成的更多详细信息,请参阅完整的渲染文档。 开发者还可以探索Angular 到 PDF 的转换以及其他JavaScript 框架支持。## IronPDF 和PrizmDoc Viewer 的许可费用有何区别?

在审查了两个组件的技术结构和可用功能后,以下概述了许可定价。 这一点至关重要,因为开发人员的目标是在预算限制内满足需求。

IronPDF有哪些许可选项?

IronPDF 许可证起价为$699适用于单个项目和一名开发人员。 IronPDF 提供灵活的许可选项,包括开发许可、部署许可扩展选项,以提供持续的支持和更新。

对于服务于多个客户的公司或机构的开发人员来说,许可证起价为 699 美元,并可根据团队规模和项目数量进行调整。 IronPDF提供随着需求变化而调整的许可证升级方案

以下许可证需要一次性付费:

开发人员数量 价格
1-5 $699
6-10 $799
11-20 $899
21-50 $1,199
无限 $1,199
  • 对于拥有多个办公地点的公司,许可证起价为1199 美元。
  • SaaS 服务的许可费用起价为1099 美元。
  • 免版税的OEM再分发许可,起价为1599美元。

注意:以上所有许可套餐均包含1 年的支持和更新

阅读更多关于IronPDF所有可用许可套餐的信息。 开发人员还可以通过多种方式应用许可证密钥,包括Web.config和环境变量。

PrizmDoc Viewer有哪些许可选项?

What Is the Cost of Self-Hosted `PrizmDoc`?

对于自行管理的服务器,标准支持服务的许可价格为每年7,900 美元

阅读更多关于PrizmDoc Viewer所有可用套餐的信息。

How Much Does Cloud-Based `PrizmDoc` Cost?

此许可证涵盖PrizmDoc Viewer 的云服务,并根据交易数量进行扩展。

术语:

Transaction是指向PrizmDoc Viewer 服务器发送请求并接收输出(结果文档)。

预付费桶是指一次性付费,即可获得永不过期的交易记录。

交易数量 预付费桶 每月 每年
200 $18
1,000 $89
2,000 $119
6,000 $254 $169 1,859 美元(6,000 笔交易/月)
12,000 $434 $289 3,179 美元(12,000 笔交易/月)
25,000 $699 $499 5,459 美元(25,000 笔交易/月)
50,000 $1,199 $799 8,789 美元(50,000 笔交易/月)
100,000 $1,199 $1,199 10,989 美元(100,000 笔交易/月)
20万 $2,549 $1,699 19,188 美元(20万 笔交易/月)
30万 $3,299 $2,199 25,188 美元(每月 30万 笔交易)
40万 $4,049 $2,699 31,188 美元(40万 笔交易/月)
500,000 $4,799 $3,199 37,188 美元(每月 500,000 笔交易)

教程快速访问

Html To Pdf `icon related to 教程快速访问

获取 C# IronPDF 快速入门手册

这是一份免费的 PDF 资源指南,它简化了 .NET 中 PDF 的开发,提供了常用函数的演练以及在 C# 和 VB.NET 中操作、编辑、生成和保存 PDF 的示例,适用于各种项目。

下载指南

探索 IronPdf API 参考资料

探索 IronPDF C# 库的 API 参考,包括 IronPDF 的所有功能、类、方法字段、命名空间和枚举的详细信息。

查看 API 参考
`documentation related to 教程快速访问

请注意Accusoft 的PrizmDoc Viewer 是其各自所有者的注册商标。 本网站与 Accusoft 的PrizmDoc Viewer 无任何关联,也未获得其认可或赞助。 所有产品名称、徽标和品牌均为各自所有者的财产。 比较仅供参考,反映的是撰写时的公开信息。

常见问题解答

如何在C#中将HTML转换为PDF?

你可以使用IronPDF的RenderHtmlAsPdf方法将HTML字符串转换为PDF。你还可以使用RenderHtmlFileAsPdf将HTML文件转换为PDF。

使用IronPDF进行PDF转换比PrizmDoc Viewer有什么优势?

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 RAM和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 对物联网 (IoT) 有浓厚的兴趣,探索将硬件和软件集成的新方法。在空闲时间,他喜欢玩游戏和构建 Discord 机器人,将他对技术的热爱与创造力相结合。