产品比较

Syncfusion PDF 查看器 HTML 转 PDF 比较

发布 2024年八月11日
分享:

介绍

一个好的和简单的PDF操作工具可以简化PDF生成和修改相关的许多过程和任务。在.NET框架内,IronPDF 和 Syncfusion 是两个强大的库,用于创建、编辑和转换 PDF 文档,而无需依赖 Adobe。本文将根据它们各自的特性、文档和许可费用对 IronPDF 进行与 Syncfusion 的比较。

IronPDF 和 Syncfusion PDF for .NET Core 概述

IronPDF 是一个为 .NET 开发人员设计的全面、功能丰富的 PDF 库,适用于 .NET Core 应用程序。它提供了从各种来源(包括 HTML 文件、图像文件和 URL)创建、编辑和渲染 PDF 文档的功能。

IronPDF 被广泛使用是因为它易于集成并且具有支持现代网页标准(如CSS3、HTML5和JavaScript)的广泛功能集。使这个库与其他库区别开来的一个特性是它能够用几行代码生成像素完美的PDF,因此即使是不熟悉复杂文件格式(如PDF)的人也适用。

Syncfusion .NET Core PDF库为.NET应用程序提供了一系列PDF操作功能。它使开发人员能够以编程方式创建、读取和编辑PDF文档。虽然Syncfusion提供了强大的功能集,但相比IronPDF可能需要更陡峭的学习曲线。该库以其详尽的文档和社区支持而闻名,使其成为开发人员寻求PDF解决方案的可行选择。

跨平台兼容性

IronPDF 和Syncfusion的基本PDF库都高度兼容多个平台;它们不仅可以跨越许多不同的系统处理PDF,还可以在.NET框架内处理。因此,我们将概述每个产品在框架和平台方面的支持情况。

IronPDF:

  • .NET 版本:

    • (C#, VB.NET, F#)

    • .NET Core (8、7、6、5 和 3.1+)

    • .NET Standard (2.0+)
  • .NET 框架 (4.6.2+)
  • 应用环境: IronPDF可在Windows、Linux、Mac、Docker、Azure和AWS等应用环境中工作
  • 集成开发环境(IDE): 支持Microsoft Visual Studio和JetBrains Rider & ReSharper等集成开发环境
  • 操作系统和处理器: 支持多种操作系统和处理器,包括Windows、Mac、Linux、x64、x86、ARM

Syncfusion:

  • .NET Standard (2.0+)
  • .NET Core 3.0
  • .NET Framework (4.6.1+)
  • 它可以与各种其他应用程序一起使用,例如 Windows Forms、ASP.NET Core、Xamarin、Flutter 等

  • 支持 Windows、Mac 和 Linux

了解更多关于 IronPDF 的兼容性 这里.

功能比较概述:IronPDF 与 Syncfusion

IronPDF 和 Syncfusion 都提供各种用于 PDF 处理的功能,因此在比较这两个库时,必须先了解每个库提供的一些具体功能。在深入探讨这些功能之前,让我们先看一下某些关键功能的概述:

IronPDF

  • HTML 转 PDF 转换: IronPDF 支持现代网页标准 (CSS3, HTML5, JavaScript),可以实现高保真PDF文档创建。
  • PDF加密:用户可以利用IronPDF强大的加密工具来加密和解密PDF文件,为PDF文件添加额外的安全层。
  • PDF编辑:IronPDF库包含合并、拆分、格式化和修改现有PDF文件的功能。
  • PDF文件的数字签名:IronPDF允许用户为他们的PDF文件进行数字签名。
  • 水印:轻松将文本和图像水印应用于PDF文件;利用HTML/CSS的优势,实现对过程的完全控制。
  • PDF图章:使用IronPDF将图像和文本图章打印到您的PDF文档上。

Syncfusion

  • PDF 创建: 使用 Syncfusion 从头开始创建 PDF 文件,或将 HTML 内容和网页转换为简单的 PDF 文档。
  • 加密 PDF: 通过使用 Syncfusion 的加密工具保护您的敏感数据安全。
  • 文本编辑: 用户可以使用 Syncfusion 编辑 PDF 文档中的文本和图像。
  • 签署 PDF: 验证并在您的 PDF 文件上添加数字签名。
  • 处理表单: 支持在您的 PDF 文档中创建表单,并允许用户填写和扁平化表单。
  • PDF 压缩: 用户可以压缩 PDF 文档以节省空间。

用户可以深入了解 IronPDF 的功能。 功能页.

IronPDF和Syncfusion功能比较

HTML 转换为 PDF

转换HTML 将内容转换为PDF是各种工作场所和环境中一个简单但必不可少的任务,下面的代码示例比较了IronPDF和Syncfusion如何处理这一过程。

IronPDF 示例:

using IronPdf;

// Disable local disk access or cross-origin requests
Installation.EnableWebSecurity = true;

// Instantiate Renderer
var renderer = new ChromePdfRenderer();

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

// Advanced Example with HTML Assets
// Load external html assets: images, CSS and JavaScript.
// An optional BasePath 'C:\site\assets\' is set as the file location to load assets from
var myAdvancedPdf = renderer.RenderHtmlAsPdf("<img src='icons/iron.png'>", @"C:\site\assets\");
myAdvancedPdf.SaveAs("html-with-assets.pdf");
using IronPdf;

// Disable local disk access or cross-origin requests
Installation.EnableWebSecurity = true;

// Instantiate Renderer
var renderer = new ChromePdfRenderer();

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

// Advanced Example with HTML Assets
// Load external html assets: images, CSS and JavaScript.
// An optional BasePath 'C:\site\assets\' is set as the file location to load assets from
var myAdvancedPdf = renderer.RenderHtmlAsPdf("<img src='icons/iron.png'>", @"C:\site\assets\");
myAdvancedPdf.SaveAs("html-with-assets.pdf");
Imports IronPdf

' Disable local disk access or cross-origin requests
Installation.EnableWebSecurity = True

' Instantiate Renderer
Dim renderer = New ChromePdfRenderer()

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

' Advanced Example with HTML Assets
' Load external html assets: images, CSS and JavaScript.
' An optional BasePath 'C:\site\assets\' is set as the file location to load assets from
Dim myAdvancedPdf = renderer.RenderHtmlAsPdf("<img src='icons/iron.png'>", "C:\site\assets\")
myAdvancedPdf.SaveAs("html-with-assets.pdf")
VB   C#

Syncfusion 示例:

using Syncfusion.Pdf;
using Syncfusion.HtmlConverter;

HtmlToPdfConverter htmlConverter = new HtmlToPdfConverter();
PdfDocument document = htmlConverter.Convert("http://www.syncfusion.com");
FileStream fileStream = new FileStream("HTML-to-PDF.pdf", FileMode.CreateNew, FileAccess.ReadWrite);
document.Save(fileStream);
document.Close(true);
using Syncfusion.Pdf;
using Syncfusion.HtmlConverter;

HtmlToPdfConverter htmlConverter = new HtmlToPdfConverter();
PdfDocument document = htmlConverter.Convert("http://www.syncfusion.com");
FileStream fileStream = new FileStream("HTML-to-PDF.pdf", FileMode.CreateNew, FileAccess.ReadWrite);
document.Save(fileStream);
document.Close(true);
Imports Syncfusion.Pdf
Imports Syncfusion.HtmlConverter

Private htmlConverter As New HtmlToPdfConverter()
Private document As PdfDocument = htmlConverter.Convert("http://www.syncfusion.com")
Private fileStream As New FileStream("HTML-to-PDF.pdf", FileMode.CreateNew, FileAccess.ReadWrite)
document.Save(fileStream)
document.Close(True)
VB   C#

当涉及将HTML转换为PDF时,IronPDF 提供了一种简化且易用的方法,同时也为用户提供了大量的控制。IronPDF 对现代网页标准有出色的支持,可以从网页生成高保真PDF文档。Syncfusion 提供了一个简单的工具用于简单的URL和HTML内容转换;然而,它缺乏对任何先进网页标准的支持。

加密PDF文件

加密 解密 PDF 文件是各种工作环境中至关重要的一部分,并且拥有能够轻松处理这项任务的工具更是必要。让我们通过下面的代码示例比较一下 IronPDF 和 Syncfusion 如何处理 PDF 加密。

IronPDF 示例:

using IronPdf;
using System;

// Open an Encrypted File, alternatively 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
// The following code makes a PDF read only and will disallow copy & paste and 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, alternatively 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
// The following code makes a PDF read only and will disallow copy & paste and 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, alternatively 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
' The following code makes a PDF read only and will disallow copy & paste and 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")
VB   C#

Syncfusion 示例:

using Syncfusion.Pdf;

PdfLoadedDocument document = new PdfLoadedDocument("input.pdf");
PdfSecurity security = document.Security;
security.UserPassword = "syncfusion";
security.Algorithm = PdfEncryptionAlgorithm.AES;
security.KeySize = PdfEncryptionKeySize.Key256Bit;
security.Permissions = PdfPermissionsFlags.Print

document.Save("encrypted.pdf");
document.Close(true);
using Syncfusion.Pdf;

PdfLoadedDocument document = new PdfLoadedDocument("input.pdf");
PdfSecurity security = document.Security;
security.UserPassword = "syncfusion";
security.Algorithm = PdfEncryptionAlgorithm.AES;
security.KeySize = PdfEncryptionKeySize.Key256Bit;
security.Permissions = PdfPermissionsFlags.Print

document.Save("encrypted.pdf");
document.Close(true);
Imports Syncfusion.Pdf

Private document As New PdfLoadedDocument("input.pdf")
Private security As PdfSecurity = document.Security
security.UserPassword = "syncfusion"
security.Algorithm = PdfEncryptionAlgorithm.AES
security.KeySize = PdfEncryptionKeySize.Key256Bit
security.Permissions = PdfPermissionsFlags.Print document.Save("encrypted.pdf")
document.Close(True)
VB   C#

IronPDF 为用户提供了一个既强大又简洁明了的加密工具。使用该工具,用户可以轻松加密他们的PDF,同时可以控制加密PDF的安全设置。相比之下,Syncfusion 的加密工具不太直观,它提供了两种加密类型,这确实为用户提供了更多的加密选项,但也意味着用户在使用该工具之前需要进行更多的工作和研究。

涂黑 PDF 内容

有时,在处理私人或敏感数据时,您可能希望 编辑 PDF文档的一部分。在以下代码示例中,我们将看看如何使用IronPDF实现修订处理,与Syncfusion进行比较。

IronPDF 示例:

using IronPdf;

PdfDocument pdf = PdfDocument.FromFile("novel.pdf");

// Redact 'are' phrase from all pages
pdf.RedactTextOnAllPages("are");

pdf.SaveAs("redacted.pdf");
using IronPdf;

PdfDocument pdf = PdfDocument.FromFile("novel.pdf");

// Redact 'are' phrase from all pages
pdf.RedactTextOnAllPages("are");

pdf.SaveAs("redacted.pdf");
Imports IronPdf

Private pdf As PdfDocument = PdfDocument.FromFile("novel.pdf")

' Redact 'are' phrase from all pages
pdf.RedactTextOnAllPages("are")

pdf.SaveAs("redacted.pdf")
VB   C#

Syncfusion 示例:

using Syncfusion.Pdf;
using Syncfusion.Pdf.Graphics;

PdfLoadedDocument loadedDocument = new PdfLoadedDocument("input.pdf");
PdfRedaction textRedaction = new PdfRedaction(new RectangleF(10, 40, 30, 30), Color.Black);
loadedDocument.Pages[0].Redactions.Add(textRedaction);
loadedDocument.Save("redacted.pdf");
loadedDocument.Close(true);
using Syncfusion.Pdf;
using Syncfusion.Pdf.Graphics;

PdfLoadedDocument loadedDocument = new PdfLoadedDocument("input.pdf");
PdfRedaction textRedaction = new PdfRedaction(new RectangleF(10, 40, 30, 30), Color.Black);
loadedDocument.Pages[0].Redactions.Add(textRedaction);
loadedDocument.Save("redacted.pdf");
loadedDocument.Close(true);
Imports Syncfusion.Pdf
Imports Syncfusion.Pdf.Graphics

Private loadedDocument As New PdfLoadedDocument("input.pdf")
Private textRedaction As New PdfRedaction(New RectangleF(10, 40, 30, 30), Color.Black)
loadedDocument.Pages(0).Redactions.Add(textRedaction)
loadedDocument.Save("redacted.pdf")
loadedDocument.Close(True)
VB   C#

IronPDF 在修订 PDF 内容方面采取了直接而简洁的方法。它拥有一个简单且直观的 API,使用户可以编程方式修订内容,从而提高工作区域的效率。Syncfusion 提供了不同的修订 PDF 内容的方法,可以移除内容、在修订区域显示文本,以及如上所示,在修订区域绘制图像。尽管 Syncfusion 的修订工具对过程提供了充分的控制,但它涉及更多的手动过程,可能需要更高的学习曲线。

为PDF文档进行数字签名

自动化 数字签名 PDF 文件可以节省大量时间。以下是一些代码示例,展示了 IronPDF 和 Syncfusion 在文档签名方面的比较。

IronPDF 示例:

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

ChromePdfRenderer renderer = new ChromePdfRenderer();
PdfDocument pdf = renderer.RenderHtmlAsPdf("<h1>foo</h1>");

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

// Create PdfSignature object
var sig = new PdfSignature(cert);

// Sign PDF document
pdf.Sign(sig);
pdf.SaveAs("signed.pdf");
using IronPdf;
using IronPdf.Signing;
using System.Security.Cryptography.X509Certificates;

ChromePdfRenderer renderer = new ChromePdfRenderer();
PdfDocument pdf = renderer.RenderHtmlAsPdf("<h1>foo</h1>");

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

// Create PdfSignature object
var sig = new PdfSignature(cert);

// Sign PDF document
pdf.Sign(sig);
pdf.SaveAs("signed.pdf");
Imports IronPdf
Imports IronPdf.Signing
Imports System.Security.Cryptography.X509Certificates

Private renderer As New ChromePdfRenderer()
Private pdf As PdfDocument = renderer.RenderHtmlAsPdf("<h1>foo</h1>")

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

' Create PdfSignature object
Private sig = New PdfSignature(cert)

' Sign PDF document
pdf.Sign(sig)
pdf.SaveAs("signed.pdf")
VB   C#

Syncfusion 示例:

using Syncfusion.Pdf;
using System.Drawing;

PdfLoadedDocument loadedDocument = new PdfLoadedDocument("input.pdf");
PdfCertificate certificate = new PdfCertificate("Syncfusion.pfx", "password");
PdfSignature signature = new PdfSignature(loadedDocument, loadedDocument.Pages[0], certificate, "Signature");
signature.Bounds = new RectangleF(0, 0, 100, 50);
loadedDocument.Save("signed.pdf");
loadedDocument.Close(true);
using Syncfusion.Pdf;
using System.Drawing;

PdfLoadedDocument loadedDocument = new PdfLoadedDocument("input.pdf");
PdfCertificate certificate = new PdfCertificate("Syncfusion.pfx", "password");
PdfSignature signature = new PdfSignature(loadedDocument, loadedDocument.Pages[0], certificate, "Signature");
signature.Bounds = new RectangleF(0, 0, 100, 50);
loadedDocument.Save("signed.pdf");
loadedDocument.Close(true);
Imports Syncfusion.Pdf
Imports System.Drawing

Private loadedDocument As New PdfLoadedDocument("input.pdf")
Private certificate As New PdfCertificate("Syncfusion.pfx", "password")
Private signature As New PdfSignature(loadedDocument, loadedDocument.Pages(0), certificate, "Signature")
signature.Bounds = New RectangleF(0, 0, 100, 50)
loadedDocument.Save("signed.pdf")
loadedDocument.Close(True)
VB   C#

IronPDF 提供了一种简单的方法来对PDF文档进行数字签名,只需较少的代码行数,从而使过程快速且容易。相比之下,Syncfusion 需要更多的代码行数,使其成为一个不那么简化的选项。

应用 PDF 水印

添加和自定义的功能 水印 使用程序处理 PDF 文件在处理机密文件、版权保护和品牌管理等任务时非常有帮助。以下是 IronPDF 和 Syncfusion 在向 PDF 文档添加水印方面的比较。

IronPDF 示例:

using IronPdf;

// Stamps a Watermark onto a new or existing PDF
var renderer = new ChromePdfRenderer();

var pdf = renderer.RenderUrlAsPdf("https://www.nuget.org/packages/IronPdf");
pdf.ApplyWatermark("<h2 style='color:red'>SAMPLE</h2>", 30, IronPdf.Editing.VerticalAlignment.Middle, IronPdf.Editing.HorizontalAlignment.Center);
pdf.SaveAs(@"C:\Path\To\Watermarked.pdf");
using IronPdf;

// Stamps a Watermark onto a new or existing PDF
var renderer = new ChromePdfRenderer();

var pdf = renderer.RenderUrlAsPdf("https://www.nuget.org/packages/IronPdf");
pdf.ApplyWatermark("<h2 style='color:red'>SAMPLE</h2>", 30, IronPdf.Editing.VerticalAlignment.Middle, IronPdf.Editing.HorizontalAlignment.Center);
pdf.SaveAs(@"C:\Path\To\Watermarked.pdf");
Imports IronPdf

' Stamps a Watermark onto a new or existing PDF
Private renderer = New ChromePdfRenderer()

Private pdf = renderer.RenderUrlAsPdf("https://www.nuget.org/packages/IronPdf")
pdf.ApplyWatermark("<h2 style='color:red'>SAMPLE</h2>", 30, IronPdf.Editing.VerticalAlignment.Middle, IronPdf.Editing.HorizontalAlignment.Center)
pdf.SaveAs("C:\Path\To\Watermarked.pdf")
VB   C#

Syncfusion 示例:

using Syncfusion.Pdf;
using Syncfusion.Pdf.Graphics;
using System.Drawing;

PdfLoadedDocument loadedDocument = new PdfLoadedDocument("input.pdf");
//Add a page to the document pdfpage page
PdfPageBase page = loadedDocument.Pages[0];
PdfGraphics graphics = page.Graphics;
PdfFont font = new PdfStandardFont(PdfFontFamily.Helvetica, 20);
PdfGraphicsState state = graphics.Save();
graphics.SetTransparency(0.25f);
graphics.DrawString("Watermark", font, PdfPens.Blue, PdfBrushes.Blue, new PointF(100, 100));
graphics.Restore(state);
loadedDocument.Save("watermarked.pdf");
loadedDocument.Close(true);
using Syncfusion.Pdf;
using Syncfusion.Pdf.Graphics;
using System.Drawing;

PdfLoadedDocument loadedDocument = new PdfLoadedDocument("input.pdf");
//Add a page to the document pdfpage page
PdfPageBase page = loadedDocument.Pages[0];
PdfGraphics graphics = page.Graphics;
PdfFont font = new PdfStandardFont(PdfFontFamily.Helvetica, 20);
PdfGraphicsState state = graphics.Save();
graphics.SetTransparency(0.25f);
graphics.DrawString("Watermark", font, PdfPens.Blue, PdfBrushes.Blue, new PointF(100, 100));
graphics.Restore(state);
loadedDocument.Save("watermarked.pdf");
loadedDocument.Close(true);
Imports Syncfusion.Pdf
Imports Syncfusion.Pdf.Graphics
Imports System.Drawing

Private loadedDocument As New PdfLoadedDocument("input.pdf")
'Add a page to the document pdfpage page
Private page As PdfPageBase = loadedDocument.Pages(0)
Private graphics As PdfGraphics = page.Graphics
Private font As PdfFont = New PdfStandardFont(PdfFontFamily.Helvetica, 20)
Private state As PdfGraphicsState = graphics.Save()
graphics.SetTransparency(0.25F)
graphics.DrawString("Watermark", font, PdfPens.Blue, PdfBrushes.Blue, New PointF(100, 100))
graphics.Restore(state)
loadedDocument.Save("watermarked.pdf")
loadedDocument.Close(True)
VB   C#

IronPDF简单有效的API使用户能够快速将水印应用到他们的PDF文档,同时由于使用了HTML/CSS,它还为用户提供了更多的过程控制。该功能简化了用户根据需求添加个性化水印的过程。但是,Syncfusion由于其水印工具的复杂性,可能没有那么高效。对于Syncfusion来说,新手必须手动完成所有操作,因此在了解该软件的操作方式之前需要花费更长的时间,这考虑到该软件在处理此类任务时的学习曲线陡峭。

将图像和文本盖印到PDF文件上

就像应用水印一样,有时您可能会处理需要某些内容的PDF页面。 盖章 将内容盖到它们上面。现在,我们将比较IronPDF和Syncfusion如何处理在PDF文档上盖章内容。

IronPDF示例:

using IronPdf;
using IronPdf.Editing;

ChromePdfRenderer renderer = new ChromePdfRenderer();

PdfDocument pdf = renderer.RenderHtmlAsPdf("<h1>Example HTML Document!</h1>");

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

// Stamp the text stamper
pdf.ApplyStamp(textStamper);
pdf.SaveAs("stampText.pdf");
using IronPdf;
using IronPdf.Editing;

ChromePdfRenderer renderer = new ChromePdfRenderer();

PdfDocument pdf = renderer.RenderHtmlAsPdf("<h1>Example HTML Document!</h1>");

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

// Stamp the text stamper
pdf.ApplyStamp(textStamper);
pdf.SaveAs("stampText.pdf");
Imports IronPdf
Imports IronPdf.Editing

Private renderer As New ChromePdfRenderer()

Private pdf As PdfDocument = renderer.RenderHtmlAsPdf("<h1>Example HTML Document!</h1>")

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

' Stamp the text stamper
pdf.ApplyStamp(textStamper)
pdf.SaveAs("stampText.pdf")
VB   C#
using IronPdf;
using IronPdf.Editing;
using System;

ChromePdfRenderer renderer = new ChromePdfRenderer();
PdfDocument pdf = renderer.RenderHtmlAsPdf("<h1>Example HTML Document!</h1>");

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

// Stamp the image stamper
pdf.ApplyStamp(imageStamper, 0);
pdf.SaveAs("stampImage.pdf");
using IronPdf;
using IronPdf.Editing;
using System;

ChromePdfRenderer renderer = new ChromePdfRenderer();
PdfDocument pdf = renderer.RenderHtmlAsPdf("<h1>Example HTML Document!</h1>");

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

// Stamp the image stamper
pdf.ApplyStamp(imageStamper, 0);
pdf.SaveAs("stampImage.pdf");
Imports IronPdf
Imports IronPdf.Editing
Imports System

Private renderer As New ChromePdfRenderer()
Private pdf As PdfDocument = renderer.RenderHtmlAsPdf("<h1>Example HTML Document!</h1>")

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

' Stamp the image stamper
pdf.ApplyStamp(imageStamper, 0)
pdf.SaveAs("stampImage.pdf")
VB   C#

Syncfusion 示例:

using Syncfusion.Pdf;
using Syncfusion.Pdf.Graphics;
using System.Drawing;

PdfLoadedDocument loadedDocument = new PdfLoadedDocument("input.pdf");
PdfPageBase page = loadedDocument.Pages[0];
PdfGraphics graphics = page.Graphics;
PdfFont font = new PdfStandardFont(PdfFontFamily.Helvetica, 12);
graphics.DrawString("Hello, World!", font, PdfBrushes.Black, new PointF(10, 10));
loadedDocument.Save("stamped.pdf");
loadedDocument.Close(true);
using Syncfusion.Pdf;
using Syncfusion.Pdf.Graphics;
using System.Drawing;

PdfLoadedDocument loadedDocument = new PdfLoadedDocument("input.pdf");
PdfPageBase page = loadedDocument.Pages[0];
PdfGraphics graphics = page.Graphics;
PdfFont font = new PdfStandardFont(PdfFontFamily.Helvetica, 12);
graphics.DrawString("Hello, World!", font, PdfBrushes.Black, new PointF(10, 10));
loadedDocument.Save("stamped.pdf");
loadedDocument.Close(true);
Imports Syncfusion.Pdf
Imports Syncfusion.Pdf.Graphics
Imports System.Drawing

Private loadedDocument As New PdfLoadedDocument("input.pdf")
Private page As PdfPageBase = loadedDocument.Pages(0)
Private graphics As PdfGraphics = page.Graphics
Private font As PdfFont = New PdfStandardFont(PdfFontFamily.Helvetica, 12)
graphics.DrawString("Hello, World!", font, PdfBrushes.Black, New PointF(10, 10))
loadedDocument.Save("stamped.pdf")
loadedDocument.Close(True)
VB   C#

IronPDF 允许用户以高度灵活和可定制的方式为 PDF 文档加盖文本和图像。它通过将整个过程置于用户的控制之下来赋予他们权力。API 简单易懂,特别适合那些对 HTML/CSS 有一定了解的人。Syncfusion 的加盖过程更为复杂,更侧重于图像而不是文本,但它仍然为用户提供了对过程的充分控制——尽管使用该工具可能仍然会有相当陡峭的学习曲线。

DOCX 转 PDF

制作 PDF 时,可能需要将不同格式的文件转换成 PDF。在这种情况下,我们将看看 DOCX 转 PDF 转换并比较IronPDF和Syncfusion如何处理此过程。

IronPDF示例:

using IronPdf;

// Instantiate Renderer
DocxToPdfRenderer renderer = new DocxToPdfRenderer();

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

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

// Instantiate Renderer
DocxToPdfRenderer renderer = new DocxToPdfRenderer();

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

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

' Instantiate Renderer
Private renderer As New DocxToPdfRenderer()

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

' Save the PDF
pdf.SaveAs("pdfFromDocx.pdf")
VB   C#

Syncfusion 示例:

using System.IO;
using Syncfusion.DocIO.DLS;
using Syncfusion.DocIORenderer;
using Syncfusion.OfficeChart;
using Syncfusion.Pdf;

WordDocument document = new WordDocument("sample.docx", FormatType.Docx);
DocToPDFConverter converter = new DocToPDFConverter();
document.ChartToImageConverter = new ChartToImageConverter();
PdfDocument pdf = converter.ConvertToPDF(document);
pdf.Save("output.pdf");
pdf.Close(true);
wordDocument.Close();
using System.IO;
using Syncfusion.DocIO.DLS;
using Syncfusion.DocIORenderer;
using Syncfusion.OfficeChart;
using Syncfusion.Pdf;

WordDocument document = new WordDocument("sample.docx", FormatType.Docx);
DocToPDFConverter converter = new DocToPDFConverter();
document.ChartToImageConverter = new ChartToImageConverter();
PdfDocument pdf = converter.ConvertToPDF(document);
pdf.Save("output.pdf");
pdf.Close(true);
wordDocument.Close();
Imports System.IO
Imports Syncfusion.DocIO.DLS
Imports Syncfusion.DocIORenderer
Imports Syncfusion.OfficeChart
Imports Syncfusion.Pdf

Private document As New WordDocument("sample.docx", FormatType.Docx)
Private converter As New DocToPDFConverter()
document.ChartToImageConverter = New ChartToImageConverter()
Dim pdf As PdfDocument = converter.ConvertToPDF(document)
pdf.Save("output.pdf")
pdf.Close(True)
wordDocument.Close()
VB   C#

IronPDF 使用一种简单直接的方法将 DOCX 文件转换为 PDF。它通过使用 ChromePdfRenderer 来完成这一点,该工具能够从各种类型的文档生成高质量的 PDF。一切都集成在 IronPDF 库中,因此在将不同的文件格式转换为 PDF 或之后保存时,不需要额外的安装。而 Syncfusion PDF 不能独立完成这种转换;它需要先在项目中安装 Syncfusion Word,才能完成任何此类转换。

功能比较摘要

IronPDF 价格与许可

IronPDF 有不同等级和额外功能的许可证供购买。开发者还可以购买 Iron Suite 这将让您以两个产品的价格获取所有IronSoftware的产品。如果您还没准备好购买许可证,IronPDF提供一个 免费试用 有效期为30天。

  • 永久许可: 根据团队规模、项目需求和地点数量提供一系列永久许可。每种许可类型都包含邮件支持。
  • Lite License: 该许可费用为$749,支持一名开发者、一个地点和一个项目。
  • Plus License: 支持三名开发者、三个地点、三个项目,该许可是Lite License的升级版,费用为$1,499。Plus License除了基本的邮件支持外,还提供聊天支持和电话支持。
  • Professional License: 该许可适合较大的团队,支持十名开发者、十个地点和十个项目,费用为$2,999。它提供与前一层相同的联系支持渠道,还提供屏幕共享支持。
  • 免版税再发布: IronPDF的许可还提供额外$1,999的免版税再发布范围。
  • 不中断的产品支持: IronPDF提供持续的产品更新、安全功能升级以及来自其工程团队的支持,费用为每年$999或者一次性支付$1,999享受5年支持。

  • Iron Suite: 费用为$1,498,可以获取所有Iron Software产品,包括IronPDF, IronOCR, IronWord, IronXL, IronBarcode, IronQR, IronZIP, IronPrint和IronWebScraper。

Syncfusion 定价和许可

Syncfusion 提供一系列的许可和等级,以满足不同开发者的需求。每种许可类型都包括24小时支持、远程支持、无限量的错误和功能请求以及在线支持系统。

  • 团队许可: 团队许可是针对开发者团队的许可,在此范围内有三个等级。

    • 最多5个开发者的团队: $395/月

    • 最多10个开发者的团队: $695/月
  • 超过10个开发者的团队: 这一等级没有设定的价格,需要您请求报价
  • 无限许可: 这些许可等级没有设定的价格,而是根据报价系统运行。

    • 项目许可: 一个指定的项目或应用程序

    • 全球许可: 整个公司范围内的所有开发人员都可以访问
  • 部门许可: 一个公司部门内的多个项目
  • 社区许可: Syncfusion 的授权软件为年总收入少于100万美元、美金,五个或更少的开发者以及总员工数不超过十人的公司和用户提供社区许可。

许可对比表

文档和支持:IronPDF与Syncfusion

IronPDF

  • 全面的文档:涵盖所有功能的广泛且用户友好的文档。
  • 24/5 支持:提供活跃的工程师支持。
  • 视频教程:YouTube 上提供逐步视频指南。
  • 社区论坛:活跃的社区提供额外支持。

  • 定期更新:每月产品更新,确保最新功能和安全补丁。

Syncfusion

  • 论坛: 提供一个社区论坛,便于在其社区内交流和学习。
  • 教程: Syncfusion 在其知识库中提供教程和指南。
  • 功能和漏洞: 用户可以提交对产品的反馈,并在遇到漏洞时提交支持票。
  • 资源: Syncfusion 提供电子书、网络研讨会、技术常见问题等。

更多关于 IronPDF 文档和支持的详细信息,请访问 IronPDF文档 和IronPDF YouTube 频道.

结论

总之,当选择用于 .NET Core 的 PDF 操作库时,IronPDF 脱颖而出,成为优越的选择。其广泛的功能集、易用性以及全面的支持和文档使其成为开发人员的理想选择。IronPDF 在多个方面表现出色,例如 HTML 到 PDF 的转换、加密、修订、数字签名和水印,为这些任务提供了精简高效的解决方案。此外,IronPDF 的定价和许可选项更加简单明了,能够很好地满足不同团队规模和项目需求,使其成为许多开发人员的经济选择。

另一方面,Syncfusion PDF for .NET Core 虽然是一款功能完备的库,但通常需要更陡峭的学习曲线和更多的手动操作才能完成类似的任务。Syncfusion 提供了大量的功能,但缺乏 IronPDF 所具备的直观易用性和灵活性。不过,您可以将其与其他 Syncfusion 工具一起使用,以进一步扩展其功能,例如其 ASP.NET PDF viewer 或 Syncfusion Word。

对于那些在 .NET 框架内寻找可靠、强大且用户友好的 PDF 库的人来说,IronPDF 显然是明智的选择。其强大的功能、用户支持和灵活的许可选项的结合,使其成为任何处理 PDF 的开发人员的宝贵工具。

< 前一页
iTextSharp C# HTML 转换为 PDF 的 .NET Core 替代方案
下一步 >
Wkhtmltopdf C# 比较与代码示例

准备开始了吗? 版本: 2024.9 刚刚发布

免费NuGet下载 总下载量: 10,731,156 查看许可证 >