在实际环境中测试
在生产中测试无水印。
随时随地为您服务。
一个好的和简单的PDF操作工具可以简化PDF生成和修改相关的许多过程和任务。在.NET框架内,IronPDF 和 Syncfusion 是两个强大的库,用于创建、编辑和转换 PDF 文档,而无需依赖 Adobe。本文将根据它们各自的特性、文档和许可费用对 IronPDF 进行与 Syncfusion 的比较。
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框架内处理。因此,我们将概述每个产品在框架和平台方面的支持情况。
.NET 版本:
(C#, VB.NET, F#)
.NET Core (8、7、6、5 和 3.1+)
了解更多关于 IronPDF 的兼容性 这里.
IronPDF 和 Syncfusion 都提供各种用于 PDF 处理的功能,因此在比较这两个库时,必须先了解每个库提供的一些具体功能。在深入探讨这些功能之前,让我们先看一下某些关键功能的概述:
用户可以深入了解 IronPDF 的功能。 功能页.
转换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")
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)
当涉及将HTML转换为PDF时,IronPDF 提供了一种简化且易用的方法,同时也为用户提供了大量的控制。IronPDF 对现代网页标准有出色的支持,可以从网页生成高保真PDF文档。Syncfusion 提供了一个简单的工具用于简单的URL和HTML内容转换;然而,它缺乏对任何先进网页标准的支持。
加密 解密 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")
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)
IronPDF 为用户提供了一个既强大又简洁明了的加密工具。使用该工具,用户可以轻松加密他们的PDF,同时可以控制加密PDF的安全设置。相比之下,Syncfusion 的加密工具不太直观,它提供了两种加密类型,这确实为用户提供了更多的加密选项,但也意味着用户在使用该工具之前需要进行更多的工作和研究。
有时,在处理私人或敏感数据时,您可能希望 编辑 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")
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)
IronPDF 在修订 PDF 内容方面采取了直接而简洁的方法。它拥有一个简单且直观的 API,使用户可以编程方式修订内容,从而提高工作区域的效率。Syncfusion 提供了不同的修订 PDF 内容的方法,可以移除内容、在修订区域显示文本,以及如上所示,在修订区域绘制图像。尽管 Syncfusion 的修订工具对过程提供了充分的控制,但它涉及更多的手动过程,可能需要更高的学习曲线。
自动化 数字签名 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")
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)
IronPDF 提供了一种简单的方法来对PDF文档进行数字签名,只需较少的代码行数,从而使过程快速且容易。相比之下,Syncfusion 需要更多的代码行数,使其成为一个不那么简化的选项。
添加和自定义的功能 水印 使用程序处理 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")
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)
IronPDF简单有效的API使用户能够快速将水印应用到他们的PDF文档,同时由于使用了HTML/CSS,它还为用户提供了更多的过程控制。该功能简化了用户根据需求添加个性化水印的过程。但是,Syncfusion由于其水印工具的复杂性,可能没有那么高效。对于Syncfusion来说,新手必须手动完成所有操作,因此在了解该软件的操作方式之前需要花费更长的时间,这考虑到该软件在处理此类任务时的学习曲线陡峭。
就像应用水印一样,有时您可能会处理需要某些内容的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")
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")
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)
IronPDF 允许用户以高度灵活和可定制的方式为 PDF 文档加盖文本和图像。它通过将整个过程置于用户的控制之下来赋予他们权力。API 简单易懂,特别适合那些对 HTML/CSS 有一定了解的人。Syncfusion 的加盖过程更为复杂,更侧重于图像而不是文本,但它仍然为用户提供了对过程的充分控制——尽管使用该工具可能仍然会有相当陡峭的学习曲线。
制作 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")
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()
IronPDF 使用一种简单直接的方法将 DOCX 文件转换为 PDF。它通过使用 ChromePdfRenderer 来完成这一点,该工具能够从各种类型的文档生成高质量的 PDF。一切都集成在 IronPDF 库中,因此在将不同的文件格式转换为 PDF 或之后保存时,不需要额外的安装。而 Syncfusion PDF 不能独立完成这种转换;它需要先在项目中安装 Syncfusion Word,才能完成任何此类转换。
IronPDF 有不同等级和额外功能的许可证供购买。开发者还可以购买 Iron Suite 这将让您以两个产品的价格获取所有IronSoftware的产品。如果您还没准备好购买许可证,IronPDF提供一个 免费试用 有效期为30天。
Syncfusion 提供一系列的许可和等级,以满足不同开发者的需求。每种许可类型都包括24小时支持、远程支持、无限量的错误和功能请求以及在线支持系统。
团队许可: 团队许可是针对开发者团队的许可,在此范围内有三个等级。
最多5个开发者的团队: $395/月
无限许可: 这些许可等级没有设定的价格,而是根据报价系统运行。
项目许可: 一个指定的项目或应用程序
更多关于 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 的开发人员的宝贵工具。