跳至页脚内容
产品比较

IronPDF与NReco .NET Core之间的比较

当您处理PDF文件时,您会希望使用最适合您的项目需求的工具,对吗? 但是市面上有这么多不同的PDF库,可能很难决定哪个最适合您。 今天,我们将深入研究两个著名的PDF库:IronPDF和NReco.PdfGenerator。

我们将比较它们的功能、兼容性和整体性能,以帮助您做出明智的决定,选择哪个库适合您。

IronPDF。和NReco.PdfGenerator概览

IronPDF是一个全面的.NET库,擅长将HTML转换为PDF,并提供一套广泛的PDF文件处理功能。 IronPDF支持现代网络标准,包括HTML5、CSS3和JavaScript,确保高保真PDF生成。 它还设计为用户友好,提供直观的API,能够无缝集成.NET应用程序。

NReco.PdfGenerator for .NET是一个专注于HTML到PDF转换的库。 它基于WkHtmlToPdf命令行工具,并依赖于遗留的Qt WebKit渲染引擎来从HTML内容创建PDF文档。 请注意,Qt WebKit不再积极维护,对现代HTML5、CSS3和JavaScript功能的支持有限。 该库以使用简单和快速集成到.NET项目中而闻名,只需一个包含WkHtmlToPdf二进制文件的.NET程序集。

跨平台兼容性

IronPDF。

IronPDF凭借其广泛的跨平台兼容性而脱颖而出。 它支持.NET框架内的多种环境,确保在不同平台之间的无缝操作。 以下是IronPDF平台兼容性的摘要:

  • .NET 版本:
  • 完全集成且支持C#、VB.NET和F#
    • .NET Core (8, 7, 6, 5, 和 3.1+)
  • .NET Standard 2.0+
  • .NET Framework 4.6.2+

  • 应用程序环境: IronPDF 可在诸多应用程序环境中工作,如 Windows, Linux, Mac, Docker, Azure, 和 AWS。
  • IDEs: 兼容如Microsoft Visual Studio和JetBrains Rider & ReSharper的IDE。
  • 操作系统和处理器: 支持多种操作系统和处理器,包括Windows、Mac、Linux、x64、x86、ARM。

有关IronPDF兼容性的更多详细信息,请访问IronPDF功能页面

NReco.PdfGenerator

  • .NET 版本:
  • .NET Standard 2.0+
  • .NET Framework 4.5+

    • .NET Core 2.0+
  • 应用环境: NReco.PdfGenerator可在Windows、Linux和macOS等多种环境中工作。 在Linux或macOS上工作时,您需要确保已安装任何必要的依赖项才可以使用。 在Windows上部署时,它可以用于.NET Core应用程序。

关键功能比较:IronPDF与NReco.PdfGenerator的PDF功能

IronPDF。 Features

  • PDF转换: IronPDF可以将HTML转换为PDF。 凭借对现代Web标准的全面支持,您可以放心地IronPDF将始终如一地从HTML内容返回像素完美的PDF文档。 IronPDF还可以将其他格式的文件转换为PDF,如DOCX、图像、RTF等。
  • PDF生成: 使用IronPDF,您可以从URL、ASPX文件或HTML字符串生成PDF文件。
  • 安全功能: 使用IronPDF,您可以始终确保任何敏感的PDF文件都是安全的,这得益于其安全功能。 使用IronPDF加密您的PDF文件,设置密码,并为PDF文件设置权限。
  • PDF编辑功能: 使用IronPDF,您可以处理现有的PDF文档,轻松地编辑和读取PDF文件。 IronPDF提供编辑功能,如添加页眉和页脚,将文本和图像印在PDF页面上,为PDF添加自定义水印,处理PDF表单,以及拆分或合并PDF文件。
  • 集成:ASP.NET和MVC应用程序无缝集成。

有关IronPDF功能的综合列表,请访问IronPDF功能

NReco.PdfGenerator功能

  • HTML到PDF转换: 使用WkHtmlToPdf和遗留的Qt WebKit引擎将HTML、CSS和基本的JavaScript转换为PDF(对现代网络标准的支持有限)。
  • PDF选项: 支持多种PDF选项,如页面方向、尺寸、边距和缩放。
  • 模板: HTML模板用于页眉、页脚和页码。
  • 内容合并: 将多个HTML页面合并成一个PDF。
  • 输出定制: 使用自定义字体和样式定制PDF的外观。
  • 部署: 使用NReco.PdfGenerator.LT可用于Windows和非Windows部署。

IronPDF与NReco.PdfGenerator顶尖功能的代码示例比较

现在,让我们仔细看看处理PDF文档时的一些常见用例,以及这两个库如何处理它们。

HTML 到 PDF 转换

IronPDF 示例:

using IronPdf;

// Enable web security settings such as disabling local disk access or cross-origin requests
Installation.EnableWebSecurity = true;

// Instantiate the renderer for creating PDFs
var renderer = new ChromePdfRenderer();

// Create a PDF from an HTML string using C#
var pdf = renderer.RenderHtmlAsPdf("<h1>Hello World</h1>");

// Export the PDF to a file
pdf.SaveAs("output.pdf");

// Advanced Example with HTML Assets
// Load external HTML assets: images, CSS, and JavaScript.
// Example uses 'c:\site\assets\' as the base path for loading assets
var myAdvancedPdf = renderer.RenderHtmlAsPdf("<img src='icons/iron.png'>", @"c:\site\assets\");
myAdvancedPdf.SaveAs("html-with-assets.pdf");
using IronPdf;

// Enable web security settings such as disabling local disk access or cross-origin requests
Installation.EnableWebSecurity = true;

// Instantiate the renderer for creating PDFs
var renderer = new ChromePdfRenderer();

// Create a PDF from an HTML string using C#
var pdf = renderer.RenderHtmlAsPdf("<h1>Hello World</h1>");

// Export the PDF to a file
pdf.SaveAs("output.pdf");

// Advanced Example with HTML Assets
// Load external HTML assets: images, CSS, and JavaScript.
// Example uses 'c:\site\assets\' as the base path for loading assets
var myAdvancedPdf = renderer.RenderHtmlAsPdf("<img src='icons/iron.png'>", @"c:\site\assets\");
myAdvancedPdf.SaveAs("html-with-assets.pdf");
Imports IronPdf

' Enable web security settings such as disabling local disk access or cross-origin requests
Installation.EnableWebSecurity = True

' Instantiate the renderer for creating PDFs
Dim renderer = New ChromePdfRenderer()

' Create a PDF from an HTML string using C#
Dim pdf = renderer.RenderHtmlAsPdf("<h1>Hello World</h1>")

' Export the PDF to a file
pdf.SaveAs("output.pdf")

' Advanced Example with HTML Assets
' Load external HTML assets: images, CSS, and JavaScript.
' Example uses 'c:\site\assets\' as the base path for loading assets
Dim myAdvancedPdf = renderer.RenderHtmlAsPdf("<img src='icons/iron.png'>", "c:\site\assets\")
myAdvancedPdf.SaveAs("html-with-assets.pdf")
$vbLabelText   $csharpLabel

NReco.PdfGenerator示例:

using System;
using NReco.PdfGenerator;

// Format HTML content with the current date and time
var htmlContent = String.Format("<body>Hello world: {0}</body>", DateTime.Now);

// Instantiate the HTML to PDF converter
var htmlToPdf = new HtmlToPdfConverter();

// Generate the PDF from the HTML content
var pdfBytes = htmlToPdf.GeneratePdf(htmlContent);
using System;
using NReco.PdfGenerator;

// Format HTML content with the current date and time
var htmlContent = String.Format("<body>Hello world: {0}</body>", DateTime.Now);

// Instantiate the HTML to PDF converter
var htmlToPdf = new HtmlToPdfConverter();

// Generate the PDF from the HTML content
var pdfBytes = htmlToPdf.GeneratePdf(htmlContent);
Imports System
Imports NReco.PdfGenerator

' Format HTML content with the current date and time
Private htmlContent = String.Format("<body>Hello world: {0}</body>", DateTime.Now)

' Instantiate the HTML to PDF converter
Private htmlToPdf = New HtmlToPdfConverter()

' Generate the PDF from the HTML content
Private pdfBytes = htmlToPdf.GeneratePdf(htmlContent)
$vbLabelText   $csharpLabel

IronPDF通过其现代化的Chromium渲染引擎(Blink)提供高保真渲染,全面支持HTML5、CSS3和JavaScript。 当使用IronPDF进行HTML到PDF转换时,您将能够从HTML文档、网页等中创建像素级完美的PDF。 NReco.PdfGenerator使用WkHtmlToPdf和遗留的Qt WebKit引擎,这对简单HTML提供基本渲染,但对现代网络标准支持有限,可能无法匹配IronPDF基于Chromium的渲染能力的精确度。

有关使用IronPDF进行HTML到PDF转换的更多示例,请访问IronPDF HTML到PDF

加密PDF文件

IronPDF 示例:

using IronPdf;
using System;

// Open an encrypted file or create a new PDF from HTML
var pdf = PdfDocument.FromFile("encrypted.pdf", "password");

// Edit file metadata
pdf.MetaData.Author = "Satoshi Nakamoto";
pdf.MetaData.Keywords = "SEO, Friendly";
pdf.MetaData.ModifiedDate = DateTime.Now;

// Edit file security settings

// Make the PDF read-only, disallow copying & pasting, and disallow printing
pdf.SecuritySettings.RemovePasswordsAndEncryption();
pdf.SecuritySettings.MakePdfDocumentReadOnly("secret-key");
pdf.SecuritySettings.AllowUserAnnotations = false;
pdf.SecuritySettings.AllowUserCopyPasteContent = false;
pdf.SecuritySettings.AllowUserFormData = false;
pdf.SecuritySettings.AllowUserPrinting = IronPdf.Security.PdfPrintSecurity.FullPrintRights;

// Change or set the document encryption password
pdf.Password = "my-password";
pdf.SaveAs("secured.pdf");
using IronPdf;
using System;

// Open an encrypted file or create a new PDF from HTML
var pdf = PdfDocument.FromFile("encrypted.pdf", "password");

// Edit file metadata
pdf.MetaData.Author = "Satoshi Nakamoto";
pdf.MetaData.Keywords = "SEO, Friendly";
pdf.MetaData.ModifiedDate = DateTime.Now;

// Edit file security settings

// Make the PDF read-only, disallow copying & pasting, and disallow printing
pdf.SecuritySettings.RemovePasswordsAndEncryption();
pdf.SecuritySettings.MakePdfDocumentReadOnly("secret-key");
pdf.SecuritySettings.AllowUserAnnotations = false;
pdf.SecuritySettings.AllowUserCopyPasteContent = false;
pdf.SecuritySettings.AllowUserFormData = false;
pdf.SecuritySettings.AllowUserPrinting = IronPdf.Security.PdfPrintSecurity.FullPrintRights;

// Change or set the document encryption password
pdf.Password = "my-password";
pdf.SaveAs("secured.pdf");
Imports IronPdf
Imports System

' Open an encrypted file or create a new PDF from HTML
Private pdf = PdfDocument.FromFile("encrypted.pdf", "password")

' Edit file metadata
pdf.MetaData.Author = "Satoshi Nakamoto"
pdf.MetaData.Keywords = "SEO, Friendly"
pdf.MetaData.ModifiedDate = DateTime.Now

' Edit file security settings

' Make the PDF read-only, disallow copying & pasting, and disallow printing
pdf.SecuritySettings.RemovePasswordsAndEncryption()
pdf.SecuritySettings.MakePdfDocumentReadOnly("secret-key")
pdf.SecuritySettings.AllowUserAnnotations = False
pdf.SecuritySettings.AllowUserCopyPasteContent = False
pdf.SecuritySettings.AllowUserFormData = False
pdf.SecuritySettings.AllowUserPrinting = IronPdf.Security.PdfPrintSecurity.FullPrintRights

' Change or set the document encryption password
pdf.Password = "my-password"
pdf.SaveAs("secured.pdf")
$vbLabelText   $csharpLabel

NReco.PdfGenerator示例: NReco.PdfGenerator does not natively support PDF encryption, as the focus of this library is primarily on handling HTML to PDF conversion.

IronPDF提供了一个简单而强大的PDF加密工具。 使用IronPDF时,您将可以完全控制整个过程,包括设置安全设置。 然而,NReco.PdfGenerator缺乏本地加密功能,因此如果您想在使用NReco.PdfGenerator转换后加密PDF文件,您将需要额外的能够处理PDF加密的库。

有关更多加密示例,请访问IronPDF 使用指南关于这个主题。

编辑PDF内容

IronPDF 示例:

using IronPdf;

// Load the PDF document
PdfDocument pdf = PdfDocument.FromFile("novel.pdf");

// Redact the word 'are' on all pages of the document
pdf.RedactTextOnAllPages("are");

// Save the redacted PDF
pdf.SaveAs("redacted.pdf");
using IronPdf;

// Load the PDF document
PdfDocument pdf = PdfDocument.FromFile("novel.pdf");

// Redact the word 'are' on all pages of the document
pdf.RedactTextOnAllPages("are");

// Save the redacted PDF
pdf.SaveAs("redacted.pdf");
Imports IronPdf

' Load the PDF document
Private pdf As PdfDocument = PdfDocument.FromFile("novel.pdf")

' Redact the word 'are' on all pages of the document
pdf.RedactTextOnAllPages("are")

' Save the redacted PDF
pdf.SaveAs("redacted.pdf")
$vbLabelText   $csharpLabel

NReco.PdfGenerator示例: NReco.PdfGenerator does not natively support text redaction.

只需几行代码,IronPDF为您提供一个简洁且易于使用的涂黑工具。 鉴于其简洁性,使用IronPDF的涂黑功能将能够立即提高您的工作效率。 另一方面,NReco.PdfGenerator将需要额外的外部库来处理涂黑过程,因为它没有本地支持PDF涂黑。

有关更多涂黑示例,请访问IronPDF 使用指南关于这个主题。

签名PDF文件

IronPDF 示例:

using IronPdf;
using IronPdf.Signing;
using System.Security.Cryptography.X509Certificates;

// Instantiate the Chrome PDF Renderer
ChromePdfRenderer renderer = new ChromePdfRenderer();

// Render HTML as PDF
PdfDocument pdf = renderer.RenderHtmlAsPdf("<h1>foo</h1>");

// Create X509Certificate2 object with the Exportable flag set
X509Certificate2 cert = new X509Certificate2("IronSoftware.pfx", "123456", X509KeyStorageFlags.Exportable);

// Create PdfSignature object and sign the PDF document
var sig = new PdfSignature(cert);
pdf.Sign(sig);

// Save the signed PDF
pdf.SaveAs("signed.pdf");
using IronPdf;
using IronPdf.Signing;
using System.Security.Cryptography.X509Certificates;

// Instantiate the Chrome PDF Renderer
ChromePdfRenderer renderer = new ChromePdfRenderer();

// Render HTML as PDF
PdfDocument pdf = renderer.RenderHtmlAsPdf("<h1>foo</h1>");

// Create X509Certificate2 object with the Exportable flag set
X509Certificate2 cert = new X509Certificate2("IronSoftware.pfx", "123456", X509KeyStorageFlags.Exportable);

// Create PdfSignature object and sign the PDF document
var sig = new PdfSignature(cert);
pdf.Sign(sig);

// Save the signed PDF
pdf.SaveAs("signed.pdf");
Imports IronPdf
Imports IronPdf.Signing
Imports System.Security.Cryptography.X509Certificates

' Instantiate the Chrome PDF Renderer
Private renderer As New ChromePdfRenderer()

' Render HTML as PDF
Private pdf As PdfDocument = renderer.RenderHtmlAsPdf("<h1>foo</h1>")

' Create X509Certificate2 object with the Exportable flag set
Private cert As New X509Certificate2("IronSoftware.pfx", "123456", X509KeyStorageFlags.Exportable)

' Create PdfSignature object and sign the PDF document
Private sig = New PdfSignature(cert)
pdf.Sign(sig)

' Save the signed PDF
pdf.SaveAs("signed.pdf")
$vbLabelText   $csharpLabel

NReco.PdfGenerator示例: NReco.PdfGenerator does not natively support digital signatures.

IronPDF的数字签名功能为您提供了自动签署PDF的简单方法。 其简单的API让您完全控制签名过程,而其易于实现则意味着如果您经常签署PDF,您可以节省不少工作量。

NReco.PdfGenerator不提供任何支持签署PDF的功能,但您可以使用第三方库,如iTextSharp来实现。

有关更多签名示例,请访问IronPDF 使用指南关于这个主题。

为PDF页面应用水印

IronPDF 示例:

using IronPdf;

// Instantiate the renderer and render a PDF from a URL
var renderer = new ChromePdfRenderer();
var pdf = renderer.RenderUrlAsPdf("https://www.nuget.org/packages/IronPdf");

// Apply an HTML-based watermark to the PDF
pdf.ApplyWatermark("<h2 style='color:red'>SAMPLE</h2>", 30, IronPdf.Editing.VerticalAlignment.Middle, IronPdf.Editing.HorizontalAlignment.Center);

// Save the watermarked PDF
pdf.SaveAs(@"C:\Path\To\Watermarked.pdf");
using IronPdf;

// Instantiate the renderer and render a PDF from a URL
var renderer = new ChromePdfRenderer();
var pdf = renderer.RenderUrlAsPdf("https://www.nuget.org/packages/IronPdf");

// Apply an HTML-based watermark to the PDF
pdf.ApplyWatermark("<h2 style='color:red'>SAMPLE</h2>", 30, IronPdf.Editing.VerticalAlignment.Middle, IronPdf.Editing.HorizontalAlignment.Center);

// Save the watermarked PDF
pdf.SaveAs(@"C:\Path\To\Watermarked.pdf");
Imports IronPdf

' Instantiate the renderer and render a PDF from a URL
Private renderer = New ChromePdfRenderer()
Private pdf = renderer.RenderUrlAsPdf("https://www.nuget.org/packages/IronPdf")

' Apply an HTML-based watermark to the PDF
pdf.ApplyWatermark("<h2 style='color:red'>SAMPLE</h2>", 30, IronPdf.Editing.VerticalAlignment.Middle, IronPdf.Editing.HorizontalAlignment.Center)

' Save the watermarked PDF
pdf.SaveAs("C:\Path\To\Watermarked.pdf")
$vbLabelText   $csharpLabel

NReco.PdfGenerator示例: NReco.PdfGenerator does not natively support watermarking.

熟悉HTML和CSS会提升您在使用IronPDF的水印工具时的体验。 您将可以完全控制整个水印过程。 水印控制的直观易学特性将让您无需多久便能熟练掌握。

如果您使用NReco.PdfGenerator并希望为新转换的PDF文件添加水印,您需要安装一个外部库,如PDFSharp。

有关更多水印示例,请访问IronPDF 使用指南关于这个主题。

在PDF文件上压印文本和图像

IronPDF 示例:

using IronPdf;
using IronPdf.Editing;

// Instantiate the renderer and render a PDF from HTML
ChromePdfRenderer renderer = new ChromePdfRenderer();
PdfDocument pdf = renderer.RenderHtmlAsPdf("<h1>Example HTML Document!</h1>");

// Create a text stamper and customize its settings
TextStamper textStamper = new TextStamper()
{
    Text = "Text Stamper!",
    FontFamily = "Bungee Spice",
    UseGoogleFont = true,
    FontSize = 30,
    IsBold = true,
    IsItalic = true,
    VerticalAlignment = VerticalAlignment.Top,
};

// Apply text stamp to the PDF
pdf.ApplyStamp(textStamper);
pdf.SaveAs("stampText.pdf");
using IronPdf;
using IronPdf.Editing;

// Instantiate the renderer and render a PDF from HTML
ChromePdfRenderer renderer = new ChromePdfRenderer();
PdfDocument pdf = renderer.RenderHtmlAsPdf("<h1>Example HTML Document!</h1>");

// Create a text stamper and customize its settings
TextStamper textStamper = new TextStamper()
{
    Text = "Text Stamper!",
    FontFamily = "Bungee Spice",
    UseGoogleFont = true,
    FontSize = 30,
    IsBold = true,
    IsItalic = true,
    VerticalAlignment = VerticalAlignment.Top,
};

// Apply text stamp to the PDF
pdf.ApplyStamp(textStamper);
pdf.SaveAs("stampText.pdf");
Imports IronPdf
Imports IronPdf.Editing

' Instantiate the renderer and render a PDF from HTML
Private renderer As New ChromePdfRenderer()
Private pdf As PdfDocument = renderer.RenderHtmlAsPdf("<h1>Example HTML Document!</h1>")

' Create a text stamper and customize its settings
Private textStamper As New TextStamper() With {
	.Text = "Text Stamper!",
	.FontFamily = "Bungee Spice",
	.UseGoogleFont = True,
	.FontSize = 30,
	.IsBold = True,
	.IsItalic = True,
	.VerticalAlignment = VerticalAlignment.Top
}

' Apply text stamp to the PDF
pdf.ApplyStamp(textStamper)
pdf.SaveAs("stampText.pdf")
$vbLabelText   $csharpLabel
using IronPdf;
using IronPdf.Editing;
using System;

// Instantiate the renderer and render a PDF from HTML
ChromePdfRenderer renderer = new ChromePdfRenderer();
PdfDocument pdf = renderer.RenderHtmlAsPdf("<h1>Example HTML Document!</h1>");

// Create an image stamper with specific settings
ImageStamper imageStamper = new ImageStamper(new Uri("https://ironpdf.com/img/svgs/iron-pdf-logo.svg"))
{
    VerticalAlignment = VerticalAlignment.Top,
};

// Apply image stamp to the PDF
pdf.ApplyStamp(imageStamper, 0);
pdf.SaveAs("stampImage.pdf");
using IronPdf;
using IronPdf.Editing;
using System;

// Instantiate the renderer and render a PDF from HTML
ChromePdfRenderer renderer = new ChromePdfRenderer();
PdfDocument pdf = renderer.RenderHtmlAsPdf("<h1>Example HTML Document!</h1>");

// Create an image stamper with specific settings
ImageStamper imageStamper = new ImageStamper(new Uri("https://ironpdf.com/img/svgs/iron-pdf-logo.svg"))
{
    VerticalAlignment = VerticalAlignment.Top,
};

// Apply image stamp to the PDF
pdf.ApplyStamp(imageStamper, 0);
pdf.SaveAs("stampImage.pdf");
Imports IronPdf
Imports IronPdf.Editing
Imports System

' Instantiate the renderer and render a PDF from HTML
Private renderer As New ChromePdfRenderer()
Private pdf As PdfDocument = renderer.RenderHtmlAsPdf("<h1>Example HTML Document!</h1>")

' Create an image stamper with specific settings
Private imageStamper As New ImageStamper(New Uri("https://ironpdf.com/img/svgs/iron-pdf-logo.svg")) With {.VerticalAlignment = VerticalAlignment.Top}

' Apply image stamp to the PDF
pdf.ApplyStamp(imageStamper, 0)
pdf.SaveAs("stampImage.pdf")
$vbLabelText   $csharpLabel

NReco.PdfGenerator示例: NReco.PdfGenerator does not natively support HTML stamping.

IronPDF提供了强大文本和图像压印工具。 使用与HTML和CSS相近的方法,您将完全控制压印过程。 相比之下,NReco.PdfGenerator需要一个外部库,如iTextSharp或PDFSharp,将文本和图像压印到新转换的PDF上。

有关更多压印示例,请访问IronPDF 使用指南关于这个主题。

DOCX 到 PDF 转换

IronPDF 示例:

using IronPdf;

// Instantiate the DOCX to PDF Renderer
DocxToPdfRenderer renderer = new DocxToPdfRenderer();

// Render a DOCX file as PDF
PdfDocument pdf = renderer.RenderDocxAsPdf("Modern-chronological-resume.docx");

// Save the converted PDF
pdf.SaveAs("pdfFromDocx.pdf");
using IronPdf;

// Instantiate the DOCX to PDF Renderer
DocxToPdfRenderer renderer = new DocxToPdfRenderer();

// Render a DOCX file as PDF
PdfDocument pdf = renderer.RenderDocxAsPdf("Modern-chronological-resume.docx");

// Save the converted PDF
pdf.SaveAs("pdfFromDocx.pdf");
Imports IronPdf

' Instantiate the DOCX to PDF Renderer
Private renderer As New DocxToPdfRenderer()

' Render a DOCX file as PDF
Private pdf As PdfDocument = renderer.RenderDocxAsPdf("Modern-chronological-resume.docx")

' Save the converted PDF
pdf.SaveAs("pdfFromDocx.pdf")
$vbLabelText   $csharpLabel

NReco.PdfGenerator示例: NReco.PdfGenerator does not natively support DOCX to PDF conversion.

使用IronPDF,您可以用几行代码将DOCX文件转换为PDF格式。 这个工具简化了实现过程,确保了高效的工作空间而不影响完成的PDF文件的质量。 使用NReco.PdfGenerator,您不能执行DOCX到PDF转换,因为该库主要专注于HTML到PDF转换。 您将需要一个额外的库,如Aspose.Words来处理DOCX到PDF的转换。

有关更多DOCX到PDF示例,请访问IronPDF 使用指南关于这个主题。

功能比较总结

IronPDF与NReco.PdfGenerator功能比较

定价和许可:IronPDF与NReco.PdfGenerator

IronPDF。 Pricing and Licensing

IronPDF拥有不同级别和附加功能的许可证购买选项。 开发者也可以购买Iron Suite,这样您就可以以双倍的价格使用Iron Software的所有产品。 如果您还未准备好购买许可,IronPDF提供一个为期30天的免费试用版

  • 永久许可证:根据您的团队规模、项目需求和地点数量提供一系列永久许可证。 每种许可证类型都配有电子邮件支持。

  • Lite License: 该许可费用为$799,支持一个开发者、一个位置和一个项目。

  • Plus许可证:支持三名开发人员、三个地点和三个项目,这是从Lite许可证的下一步,费用是$1,199。 Plus许可证除了电子邮件支持外,还提供聊天支持和电话支持。

  • 专业许可证: 适合更大的团队,支持十名开发者、十个地点和十个项目,价格为 $2,399。 它提供与前一层相同的联系支持渠道,并且还提供屏幕共享支持。

  • 无版权费再发布: IronPDF的许可提供无版权费再发布覆盖,费用额外为$2,399。

  • 不间断产品支持: 可以获得Ongoing产品更新、安全功能升级和来自其工程团队的支持,费用为$1,199/年或一次性购买$2,399可获得5年支持。

  • Iron Suite: 以$1,498价格,您可以使用Iron Software的所有产品,包括IronPDF、IronOCR、IronWord、IronXL、IronBarcode、IronQR、IronZIP、IronPrint和IronWebScraper。

IronPDF与NReco.PdfGenerator定价比较

NReco.PdfGenerator

  • 免费版本: NReco.PdfGenerator提供一个免费的在线HTML到PDF转换器。

  • 企业源代码包: NReco提供一个PDF生成器企业源代码包,费用为$199,包括商业许可以进行再发布、用于高级API/NReco.PdfGenerator LT NuGet包版本的许可密钥、一年的电子邮件支持和源码ZIP文件访问。

文档和支持:IronPDF与NReco.PdfGenerator

IronPDF。

IronPDF在提供详细使用文档和支持方面表现突出:

  • 完整文档:全面且用户友好的文档,涵盖所有功能。
  • 24/5 支持:提供工程师的积极支持。
  • 视频教程:在 YouTube 上提供逐步视频指南。
  • 社区论坛: 一个活跃的社区提供额外的支持。
  • 定期更新: 每月产品更新,以确保最新功能及安全补丁。

For more information, check out IronPDF's extensive documentation and visit the Iron Software YouTube Channel.

NReco.PdfGenerator

  • API参考: 提供关于其API的文档,让您了解其不同方面的工作原理。
  • 联系: 在其网站上轻松找到NReco团队的所有联系信息,方便您在遇到任何问题或疑问时与他们联系。

支持现代 CSS 框架

IronPDF和NReco.PdfGenerator的关键区别在于它们对现代CSS框架的支持,如Bootstrap、Tailwind CSS和Foundation。

IronPDF。: Full Bootstrap Support

IronPDF的Chromium渲染引擎提供对现代CSS框架的全面支持:

  • Bootstrap 5:对响应式布局的全flexbox和CSS Grid支持
  • Complex layouts: Renders the Bootstrap homepage and Bootstrap templates pixel-perfect
  • 现代功能:CSS3 动画、转换、过渡和媒体查询
  • CSS框架:Bootstrap、Tailwind CSS、Foundation、Bulma均可无缝运行

代码示例:渲染 Bootstrap 内容

using IronPdf;

// Render a Bootstrap 5 layout
var renderer = new ChromePdfRenderer();

// Example: Bootstrap responsive card grid
string bootstrapHtml = @"
<!DOCTYPE html>
<html>
<head>
    <link href='https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css' rel='stylesheet'>
</head>
<body>
    <div class='container mt-5'>
        <h1 class='mb-4'>Product Catalog</h1>
        <div class='row g-4'>
            <div class='col-lg-4 col-md-6'>
                <div class='card h-100 shadow'>
                    <div class='card-body d-flex flex-column'>
                        <h5 class='card-title'>Product A</h5>
                        <p class='card-text flex-grow-1'>Modern flexbox-based card layout with Bootstrap 5.</p>
                        <button class='btn btn-primary mt-auto'>Learn More</button>
                    </div>
                </div>
            </div>
            <div class='col-lg-4 col-md-6'>
                <div class='card h-100 shadow'>
                    <div class='card-body d-flex flex-column'>
                        <h5 class='card-title'>Product B</h5>
                        <p class='card-text flex-grow-1'>Responsive grid adapts to screen size.</p>
                        <button class='btn btn-primary mt-auto'>Learn More</button>
                    </div>
                </div>
            </div>
            <div class='col-lg-4 col-md-6'>
                <div class='card h-100 shadow'>
                    <div class='card-body d-flex flex-column'>
                        <h5 class='card-title'>Product C</h5>
                        <p class='card-text flex-grow-1'>CSS3 features fully supported.</p>
                        <button class='btn btn-primary mt-auto'>Learn More</button>
                    </div>
                </div>
            </div>
        </div>
    </div>
</body>
</html>";

var pdf = renderer.RenderHtmlAsPdf(bootstrapHtml);
pdf.SaveAs("bootstrap-catalog.pdf");
using IronPdf;

// Render a Bootstrap 5 layout
var renderer = new ChromePdfRenderer();

// Example: Bootstrap responsive card grid
string bootstrapHtml = @"
<!DOCTYPE html>
<html>
<head>
    <link href='https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css' rel='stylesheet'>
</head>
<body>
    <div class='container mt-5'>
        <h1 class='mb-4'>Product Catalog</h1>
        <div class='row g-4'>
            <div class='col-lg-4 col-md-6'>
                <div class='card h-100 shadow'>
                    <div class='card-body d-flex flex-column'>
                        <h5 class='card-title'>Product A</h5>
                        <p class='card-text flex-grow-1'>Modern flexbox-based card layout with Bootstrap 5.</p>
                        <button class='btn btn-primary mt-auto'>Learn More</button>
                    </div>
                </div>
            </div>
            <div class='col-lg-4 col-md-6'>
                <div class='card h-100 shadow'>
                    <div class='card-body d-flex flex-column'>
                        <h5 class='card-title'>Product B</h5>
                        <p class='card-text flex-grow-1'>Responsive grid adapts to screen size.</p>
                        <button class='btn btn-primary mt-auto'>Learn More</button>
                    </div>
                </div>
            </div>
            <div class='col-lg-4 col-md-6'>
                <div class='card h-100 shadow'>
                    <div class='card-body d-flex flex-column'>
                        <h5 class='card-title'>Product C</h5>
                        <p class='card-text flex-grow-1'>CSS3 features fully supported.</p>
                        <button class='btn btn-primary mt-auto'>Learn More</button>
                    </div>
                </div>
            </div>
        </div>
    </div>
</body>
</html>";

var pdf = renderer.RenderHtmlAsPdf(bootstrapHtml);
pdf.SaveAs("bootstrap-catalog.pdf");
IRON VB CONVERTER ERROR developers@ironsoftware.com
$vbLabelText   $csharpLabel

上述代码在IronPDF中完美呈现,保留了所有Bootstrap样式、弹性布局、阴影和响应式网格系统。

NReco.PdfGenerator: 有限的Bootstrap支持

NReco.PdfGenerator依赖于WkHtmlToPdf和遗留的Qt WebKit引擎,这对于现代CSS框架有严重限制:

  • 无flexbox支持:Bootstrap 4+严重依赖于flexbox,但Qt WebKit无法完全支持
  • 有限的CSS Grid:现代网格布局将无法正确渲染
  • 过时:Qt WebKit最后更新于2016年,缺乏对现代CSS3功能的支持
  • 需要工作arounds:开发人员必须使用较旧的Bootstrap版本(Bootstrap 3或更早)或实施基于表格的回退

有关CSS框架支持和排除flexbox/Bootstrap渲染问题的更多详细信息,请参阅Bootstrap和Flexbox CSS指南

结论

IronPDF和NReco.PdfGenerator都是符合你所有HTML到PDF转换需求的强大竞争者。 然而,如果您需要具备丰富内置功能,而不仅仅是HTML到PDF转换的工具,那么IronPDF就是为您量身打造的。

凭借全面的功能集、简单的学习曲线,以及对现代网络标准和跨平台兼容性的广泛支持,IronPDF将是您工作场所的强大补充。 NReco.PdfGenerator 虽然在基本的HTML到PDF转换方面可靠,但缺乏IronPDF提供的许多高级功能。

您可以尝试30天免费试用 以查看他们提供的功能。

[{i:(NReco.PdfGenerator是其各自所有者的注册商标。 本网站与NReco.PdfGenerator无关,未经其认可或赞助。 所有产品名称、徽标和品牌均为其各自所有者的财产。 比较仅供参考,反映的是撰写时的公开信息。]

常见问题解答

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

您可以使用 IronPDF 的 RenderHtmlAsPdf 方法将 HTML 字符串转换为 PDF。此外,IronPDF 允许您使用 RenderHtmlFileAsPdf 方法将 HTML 文件转换为 PDF。

IronPDF 和 NReco.PdfGenerator 之间的主要区别是什么?

IronPDF 提供广泛的功能,包括 HTML 到 PDF 转换、PDF 编辑、安全选项和数字签名,使其成为 PDF 操作的综合工具。相比之下,NReco.PdfGenerator 主要集中在使用 WkHtmlToPdf 工具进行 HTML 到 PDF 转换,具有较少的高级功能。

我可以在不同操作系统上使用这些 PDF 库吗?

是的,IronPDF 和 NReco.PdfGenerator 都支持跨平台兼容性。IronPDF 可在 Windows、Linux 和 macOS 上使用,并支持 .NET Core、.NET Standard 和 .NET Framework。同样,NReco.PdfGenerator 也支持 Windows、Linux 和 macOS 平台。

IronPDF 是否支持 PDF 加密和数字签名?

是的,IronPDF 提供了强大的 PDF 加密和数字签名功能。这允许开发人员保护他们的 PDF 文件并添加用于验证目的的数字签名。

IronPDF有哪些许可选项?

IronPDF 提供多种授权选项,包括 Lite、Plus 和 Professional 许可证。此外,还有 Iron Suite,提供对所有 Iron Software 产品的访问,并提供 30 天免费试用以进行评估。

是否有免费的 NReco.PdfGenerator 版本可用?

是的,NReco.PdfGenerator 提供一个免费的在线 HTML 到 PDF 转换器。为了更广泛的使用,可以购买企业源代码包。

哪个库提供更好的支持和文档?

IronPDF 提供全面的文档、视频教程、24/5 客户支持、社区论坛以及定期的软件更新。NReco.PdfGenerator 提供 API 文档和支持联系信息。

IronPDF 能否将 DOCX 文件转换为 PDF?

是的,IronPDF 可以将 DOCX 文件转换为 PDF 格式,在转换过程中确保高质量并保持文档的保真度。

使用IronPDF进行HTML到PDF转换的优势是什么?

IronPDF 支持现代 web 标准以实现高保真 PDF 渲染,确保像素完美的 PDF。它还包括诸如 HTML 资源加载和全面的 PDF 安全设置等功能,使其成为 HTML 到 PDF 转换的强大选择。

NReco.PdfGenerator 是否支持诸如 PDF 涂黑或水印等功能?

不,NReco.PdfGenerator 本身不支持 PDF 涂黑或水印。然而,IronPDF 提供了内置支持这些功能的功能,允许轻松涂黑和添加 PDF 文档的水印。

IronPDF 和 NReco.PdfGenerator 的一些常见用例是什么?

IronPDF 通常用于 HTML 到 PDF 转换、PDF 加密、数字签名以及编辑现有 PDF。NReco.PdfGenerator 主要用于将 HTML 内容转换为 PDF 格式。

Curtis Chau
技术作家

Curtis Chau 拥有卡尔顿大学的计算机科学学士学位,专注于前端开发,精通 Node.js、TypeScript、JavaScript 和 React。他热衷于打造直观且美观的用户界面,喜欢使用现代框架并创建结构良好、视觉吸引力强的手册。

除了开发之外,Curtis 对物联网 (IoT) 有浓厚的兴趣,探索将硬件和软件集成的新方法。在空闲时间,他喜欢玩游戏和构建 Discord 机器人,将他对技术的热爱与创造力相结合。