产品比较

Aspose PDF转换器教程与对比

介绍

IronPDF 和 Aspose PDF .NET 是两个专为 .NET 应用程序中的 PDF 操作设计的强大库。 每个产品都提供了一套独特的功能,以便于PDF文档的创建、编辑和处理。 在本文中,我们将探讨这两种工具的一些功能,以及它们的许可选项、文档和支持。

IronPDF 和 Aspose.PDF 的概述

IronPDF是为.NET开发者设计的全面PDF库。 它提供了从各种源(包括HTML、ASPX和URL)创建、编辑和渲染PDF文件的功能。 IronPDF 因其易于集成和支持现代网页标准(如 CSS3、HTML5 和 JavaScript)的广泛功能集而被广泛使用。 IronPDF 致力于通过最少的代码提供高保真度的 PDF 文件,使其成为开发者寻求强大且用户友好的 PDF 文件解决方案的理想选择。

Aspose.PDF for .NET 是一个复杂的 API,能够处理复杂的 PDF 文件操作。 此库允许开发者在各种.NET平台上创建、修改和操作PDF文件,包括WinForms、WPF、ASP.NET和.NET Core。 用托管的C#编写,Aspose.PDF强调灵活性和性能,非常适合需要复杂PDF操作的企业级应用程序。

跨平台兼容性

IronPDF和Aspose.PDF都与.NET框架、.NET Core、Azure和Windows具有很强的兼容性。 不过,IronPDF 可直接提供跨平台兼容性,而 Aspose.PDF 则无法在跨平台环境中运行,需要使用 Aspose.Pdf.Drawing 软件包。

考虑到这一点,IronPDF以其广泛的跨平台兼容性为傲,支持各种.NET版本、.NET项目类型和操作系统。 以下是IronPDF的主要兼容性亮点:

  • .NET 版本:.NET 8, 7, 6, Core 和 Framework。
  • 操作系统:Windows、Linux、Mac。
  • 云服务:完全兼容Azure和AWS环境。
  • 部署:轻松部署在桌面、服务器和云环境中。

功能比较概述:IronPDF vs. Aspose.PDF

在比较IronPDF和Aspose.PDF时,查看每个库提供的具体功能是至关重要的。 以下是主要功能的分解:

IronPDF

  • HTML 到 PDF 转换:IronPDF 支持现代网络标准(CSS3、HTML5、JavaScript),这使得高保真 PDF 文档创建成为可能。
  • PDF编辑:包括合并、拆分和修改PDF文件的功能。
  • PDF 生成:从 URL、ASPX 文件或 HTML 字符串生成和转换 PDF 文档。
  • 安全性:为PDF添加密码和权限。
  • 水印:将文本和图像水印应用于PDF文件。
  • 兼容性:可与.NET Framework、.NET Core、Azure、AWS以及各种操作系统配合使用。
  • 注释:在PDF文档中添加文本、图像和链接注释。

Aspose.PDF .NET

  • PDF 创建:从头开始创建 PDF 或将各种文件格式转换为 PDF。
  • 文档操作:合并、拆分和操作现有的PDF文档。
  • 表单处理:填写、提取、合并和管理PDF表单。 Aspose.PDF 也可以导入和导出 PDF 表单数据。
  • 注释和印章:向 PDF 文件添加和提取注释和印章。
  • 安全功能:使用 Aspose.PDF,您可以加密 PDF 文档、解密 PDF 文档、设置文档查看器首选项并管理权限。
  • 转换:将PDF转换为其他格式,如DOC、XLS和HTML。
  • 复杂内容处理:管理复杂的文档结构,例如表格和书签。

IronPDF与Aspose.PDF功能比较

HTML 转换为 PDF

以下代码示例展示了如何将HTML内容转换为PDF,并比较了这两款产品完成该任务的方式。

IronPDF:

using IronPdf;

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

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

// Create a PDF from an 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.
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 an 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.
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 an 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.
Dim myAdvancedPdf = renderer.RenderHtmlAsPdf("<img src='icons/iron.png'>", "C:\site\assets\")
myAdvancedPdf.SaveAs("html-with-assets.pdf")
$vbLabelText   $csharpLabel

Aspose.PDF

using Aspose.Pdf;
using Aspose.Pdf.Text;

Document doc = new Document();
Page page = doc.Pages.Add();
HtmlFragment text = new HtmlFragment("<h1>Hello World</h1>");
page.Paragraphs.Add(text);
doc.Save("output.pdf");
using Aspose.Pdf;
using Aspose.Pdf.Text;

Document doc = new Document();
Page page = doc.Pages.Add();
HtmlFragment text = new HtmlFragment("<h1>Hello World</h1>");
page.Paragraphs.Add(text);
doc.Save("output.pdf");
Imports Aspose.Pdf
Imports Aspose.Pdf.Text

Private doc As New Document()
Private page As Page = doc.Pages.Add()
Private text As New HtmlFragment("<h1>Hello World</h1>")
page.Paragraphs.Add(text)
doc.Save("output.pdf")
$vbLabelText   $csharpLabel

IronPDF 提供了一种简洁高效的方法,将 HTML 内容转换为 PDF 文件,其对现代网络标准的出色支持使这一过程变得轻松。 Aspose.PDF 提供了一个强大的API,可以处理HTML到PDF的转换; 然而,翻译过程可能不太简单,需要更多步骤。

加密PDF文件

处理敏感信息或私人数据时,能够加密和解密PDF文件在任何环境中都可能是必不可少的。 下面,我们比较这两款产品如何处理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")
$vbLabelText   $csharpLabel

Aspose.PDF:

using Aspose.Pdf;

Document pdfDocument = new Document("document.pdf");
pdfDocument.Encrypt("password", null, Permissions.PrintDocument, CryptoAlgorithm.AESx128);
pdfDocument.Save("encrypted.pdf");
using Aspose.Pdf;

Document pdfDocument = new Document("document.pdf");
pdfDocument.Encrypt("password", null, Permissions.PrintDocument, CryptoAlgorithm.AESx128);
pdfDocument.Save("encrypted.pdf");
Imports Aspose.Pdf

Private pdfDocument As New Document("document.pdf")
pdfDocument.Encrypt("password", Nothing, Permissions.PrintDocument, CryptoAlgorithm.AESx128)
pdfDocument.Save("encrypted.pdf")
$vbLabelText   $csharpLabel

虽然这两个库都提供强大的加密工具,但IronPDF提供了一个简化的加密过程,同时还让用户对他们正在加密的PDF文件的安全设置拥有更多的控制。 Aspose.PDF 的加密过程同样简洁明了; 然而,它在控制各种设置的便利性上不如其他产品。

编辑 PDF 内容

有时候,特别是在处理私人或敏感数据时,您可能希望编辑 PDF 文档的某些部分。 下面,我们将比较IronPDF和Aspose.PDF中的文本涂改功能如何运作。

IronPDF:

using IronPdf;

//Load the document you want to use
PdfDocument pdf = PdfDocument.FromFile("novel.pdf");

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

//Save the redacted version of the document
pdf.SaveAs("redacted.pdf");
using IronPdf;

//Load the document you want to use
PdfDocument pdf = PdfDocument.FromFile("novel.pdf");

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

//Save the redacted version of the document
pdf.SaveAs("redacted.pdf");
Imports IronPdf

'Load the document you want to use
Private pdf As PdfDocument = PdfDocument.FromFile("novel.pdf")

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

'Save the redacted version of the document
pdf.SaveAs("redacted.pdf")
$vbLabelText   $csharpLabel

Aspose.PDF:

using Aspose.Pdf;
using Aspose.Pdf.Redaction;

Document document = new Document("novel.pdf");
TextFragmentAbsorber textFragmentAbsorber = new TextFragmentAbsorber("confidential");
document.Pages.Accept(textFragmentAbsorber);
foreach (TextFragment textFragment in textFragmentAbsorber.TextFragments)
{
    textFragment.Text = "XXXXX";
}
document.Save("redacted.pdf");
using Aspose.Pdf;
using Aspose.Pdf.Redaction;

Document document = new Document("novel.pdf");
TextFragmentAbsorber textFragmentAbsorber = new TextFragmentAbsorber("confidential");
document.Pages.Accept(textFragmentAbsorber);
foreach (TextFragment textFragment in textFragmentAbsorber.TextFragments)
{
    textFragment.Text = "XXXXX";
}
document.Save("redacted.pdf");
Imports Aspose.Pdf
Imports Aspose.Pdf.Redaction

Private document As New Document("novel.pdf")
Private textFragmentAbsorber As New TextFragmentAbsorber("confidential")
document.Pages.Accept(textFragmentAbsorber)
For Each textFragment As TextFragment In textFragmentAbsorber.TextFragments
	textFragment.Text = "XXXXX"
Next textFragment
document.Save("redacted.pdf")
$vbLabelText   $csharpLabel

在编辑 PDF 内容方面,IronPDF 提供了一种直接的方法。 其直观简洁的 API 使用户能够以编程方式编辑内容,从而提高了工作空间的效率。 Aspose.PDF可以实现类似的结果,但过程更加手动。 如果想像 IronPDF 那样在文本上画黑框,过程就会变得更加复杂。

对PDF文档进行数字签名

当需要对 PDF 文档进行数字签名时,通过编程实现可以节省大量时间。下面的代码示例比较了IronPDF 和 Aspose.PDF 的签名过程

IronPDF:

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

// 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
PdfDocument pdf = PdfDocument.FromFile("document.pdf");
pdf.Sign(sig);
pdf.SaveAs("signed.pdf");
using IronPdf;
using IronPdf.Signing;
using System.Security.Cryptography.X509Certificates;

// 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
PdfDocument pdf = PdfDocument.FromFile("document.pdf");
pdf.Sign(sig);
pdf.SaveAs("signed.pdf");
Imports IronPdf
Imports IronPdf.Signing
Imports System.Security.Cryptography.X509Certificates

' 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
Private pdf As PdfDocument = PdfDocument.FromFile("document.pdf")
pdf.Sign(sig)
pdf.SaveAs("signed.pdf")
$vbLabelText   $csharpLabel

Aspose.PDF:

using Aspose.Pdf;
using Aspose.Pdf.Forms;
using Aspose.Pdf.Facades;

Document document = new Document("input.pdf");
PKCS7 pkcs = new PKCS7("signature.pfx", "password");
Document.SignatureField signatureField = new SignatureField(document.Pages[1], new Rectangle(100, 100, 200, 200));
document.Form.Add(signatureField);
document.Save("signed.pdf");
using Aspose.Pdf;
using Aspose.Pdf.Forms;
using Aspose.Pdf.Facades;

Document document = new Document("input.pdf");
PKCS7 pkcs = new PKCS7("signature.pfx", "password");
Document.SignatureField signatureField = new SignatureField(document.Pages[1], new Rectangle(100, 100, 200, 200));
document.Form.Add(signatureField);
document.Save("signed.pdf");
Imports Aspose.Pdf
Imports Aspose.Pdf.Forms
Imports Aspose.Pdf.Facades

Private document As New Document("input.pdf")
Private pkcs As New PKCS7("signature.pfx", "password")
Private signatureField As Document.SignatureField = New SignatureField(document.Pages(1), New Rectangle(100, 100, 200, 200))
document.Form.Add(signatureField)
document.Save("signed.pdf")
$vbLabelText   $csharpLabel

IronPDF 提供了一种简单直接的签署PDF文件的过程,只需更少的代码行,因此使过程快速而简单。 Aspose.PDF 具有较长的处理流程,需要更多的代码行来实现相同的结果,但它确实允许用户对流程有更多的控制。

应用 PDF 水印

能够以编程方式在PDF文档上添加和自定义水印非常有用,特别是在处理机密文件、品牌、确保版权保护等情况时。 现在,我们将比较 IronPDF 和 Aspose.PDF 如何在 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")
$vbLabelText   $csharpLabel

Aspose.PDF:

using Aspose.Pdf;
using Aspose.Pdf.Text;

Document document = new Document("input.pdf");
TextStamp textStamp = new TextStamp("Confidential");
textStamp.Background = true;
textStamp.Opacity = 0.5;
document.Pages[1].AddStamp(textStamp);
document.Save("watermarked.pdf");
using Aspose.Pdf;
using Aspose.Pdf.Text;

Document document = new Document("input.pdf");
TextStamp textStamp = new TextStamp("Confidential");
textStamp.Background = true;
textStamp.Opacity = 0.5;
document.Pages[1].AddStamp(textStamp);
document.Save("watermarked.pdf");
Imports Aspose.Pdf
Imports Aspose.Pdf.Text

Private document As New Document("input.pdf")
Private textStamp As New TextStamp("Confidential")
textStamp.Background = True
textStamp.Opacity = 0.5
document.Pages(1).AddStamp(textStamp)
document.Save("watermarked.pdf")
$vbLabelText   $csharpLabel

IronPDF 简单而高效的 API 允许用户快速对其 PDF 文档应用水印,同时由于使用 HTML/CSS,使用户对整个过程拥有更多控制。 这使用户能够根据自己的需求轻松应用自定义水印。 Aspose.PDF 缺乏本地水印工具,因此使用 TextStamp 方法代替。 虽然这能达到类似的结果,但它对过程的控制较少。

在PDF上加盖图像和文字

就像添加水印一样,有时您可能需要在PDF页面上加盖印章。 现在,我们将比较IronPDF和Aspose.PDF如何处理将内容加盖到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")
$vbLabelText   $csharpLabel
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")
$vbLabelText   $csharpLabel

Aspose.PDF:

using Aspose.Pdf;
using Aspose.Pdf.Text;

Document document = new Document("input.pdf");
ImageStamp imageStamp = new ImageStamp("logo.png");
imageStamp.Background = true; // Enable background for the stamp
document.Pages[1].AddStamp(imageStamp);
document.Save("stamped.pdf");
using Aspose.Pdf;
using Aspose.Pdf.Text;

Document document = new Document("input.pdf");
ImageStamp imageStamp = new ImageStamp("logo.png");
imageStamp.Background = true; // Enable background for the stamp
document.Pages[1].AddStamp(imageStamp);
document.Save("stamped.pdf");
Imports Aspose.Pdf
Imports Aspose.Pdf.Text

Private document As New Document("input.pdf")
Private imageStamp As New ImageStamp("logo.png")
imageStamp.Background = True ' Enable background for the stamp
document.Pages(1).AddStamp(imageStamp)
document.Save("stamped.pdf")
$vbLabelText   $csharpLabel

在将文本和图像加盖到PDF文档时,IronPDF提供了极大的灵活性和可定制性,使用户能够完全控制该过程。 它的 API 使用简单直接,特别适合熟悉 HTML/CSS 的用户。 Aspose.PDF 的定制性和灵活性较低,保持了一种简单且专注于标记的方式,尽管在控制和直观感上不如IronPDF。

DOCX 转 PDF

当涉及到创建PDF文件时,将各种文件类型转换为PDF可能是必不可少的。 对于这个示例,我们将特别看一下如何将DOCX文件类型转换为PDF。

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

Aspose.PDF:

using Aspose.Words;
using Aspose.Words.Saving;

Document doc = new Document("input.docx");
doc.Save("output.pdf", SaveFormat.Pdf);
using Aspose.Words;
using Aspose.Words.Saving;

Document doc = new Document("input.docx");
doc.Save("output.pdf", SaveFormat.Pdf);
Imports Aspose.Words
Imports Aspose.Words.Saving

Private doc As New Document("input.docx")
doc.Save("output.pdf", SaveFormat.Pdf)
$vbLabelText   $csharpLabel

IronPDF 提供了一种简便直接的方法,将DOCX转换为PDF,利用ChromePdfRenderer从DOCX文件生成高质量的PDF。 这一切都内置在 IronPDF 库中,不需要额外的软件包,就能从各种文件类型中转换 PDF 文档,然后在最后保存。

Aspose.PDF 本身无法将 DOCX 文件转换为 PDF 格式,而是需要使用 Aspose.Words 包进行转换,然后用户可以实施 Aspose.PDF 以进一步处理 PDF 文件。

功能比较概要

IronPDF 与 Aspose.PDF 功能比较

定价与许可证:IronPDF 与 Aspose.PDF

在定价和许可方面,IronPDF 许可选项 提供了一种简单而具有成本效益的方法:

IronPDF 定价和许可

IronPDF Licensing 具有不同的级别和附加功能,用于购买许可证。 开发人员还可以购买Iron Suite,只需支付两个产品的价格即可获得所有Iron Software产品的访问权限。 如果您还没有准备好购买许可证,IronPDF 提供了一个免费试用,有效期为30天。

  • 永久许可证:提供多种永久许可证,具体取决于您的团队规模、项目需求和地点数量。 每种许可类型都包括电子邮件支持。
  • Lite License:该许可证费用为$749,支持一名开发人员、一个位置和一个项目。
  • Plus License:支持三位开发人员、三个地点和三个项目,这是从Lite License升级的下一步,费用为$1,499。Plus 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。

    IronPDF 定价选项

Aspose.PDF 定价

Aspose.PDF 的许可费用分为多个级别,每个级别都有自己的功能,并且都提供免费支持。 希望使用 Aspose.PDF 的开发人员可能需要额外购买才能完成某些操作,正如我们在将 DOCX 转换为 PDF 格式时看到的那样。

  • 开发者小型企业:此层级费用为1,679美元,支持一名开发者和一个部署地点。
  • 开发者 OEM:该等级的费用为 $5,037,支持一名开发者进行无限制的部署地点支持。
  • 开发者SDK:该等级的费用为33,580美元,支持一名开发人员和50次商业部署。
  • 附加:每个级别提供两个额外的服务,您可以与许可证一起购买,分别是付费支持和付费咨询。 这些附加服务的费用随许可证的不同而增加,最便宜的是小型企业开发者计划,付费支持费用为每年 399 美元,咨询费用为每位开发者每月 5999 美元。

    IronPDF提供了一种更具成本效益的解决方案,特别是在考虑到Iron Suite套件时,该套件以两个库的价格包含多个强大的库。 有关详细的定价信息,请访问IronPDF 授权页面

许可对照表

IronPDF与Aspose.PDF许可对比

文档和支持:IronPDF vs. Aspose.PDF

IronPDF

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

Aspose.PDF

  • 详细文档:包含代码示例的全面文档。
  • 技术支持:标准支持在工作时间内提供。
  • 社区参与:积极的论坛用于点对点支持。
  • 培训:在线培训材料可用。

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

结论

IronPDF for .NET 和 Aspose.PDF .NET 在.NET 环境中处理 PDF 文档时都提供了大量功能。 每个产品都有其独特的优势和功能。

IronPDF以其跨平台兼容性、对现代网络标准如CSS3、HTML5和JavaScript的广泛支持、使用简便性、成本效益以及在无需额外软件包的情况下完成各种PDF操作任务的能力而自豪。 IronPDF是一个强大的工具,当您想要简化PDF生成和操作任务时,可以添加到您的开发者工具包中。

Iron Suite 用户可以利用 IronPDF 与其他 Iron Software 产品的顺畅集成,实现更高级的操作。 例如,用户可以使用 IronQR 将二维码添加到他们的PDF中,使用 IronZip 压缩他们的PDF文件,使用 IronPrint 打印PDF文档,并执行任何其他潜在的操作。

另一方面,虽然 Aspose.PDF 是一个强大的工具,提供了丰富的功能,用于复杂的 PDF 操作、详细的配置,并且能够在 .NET 环境中无缝操作,但它通常需要外部包来完成任务。 虽然它拥有一个活跃的支持论坛,并能轻松执行各种与 PDF 相关的任务。

最终选择IronPDF还是Aspose.PDF取决于具体项目需求。 IronPDF提供具有竞争力的定价、详尽的文档、响应迅速的支持以及强大的PDF操作工具,所有这些都在一个套餐中。

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

Chipego
软件工程师
Chipego 拥有出色的倾听技巧,这帮助他理解客户问题并提供智能解决方案。他在 2023 年加入 Iron Software 团队,此前他获得了信息技术学士学位。IronPDF 和 IronOCR 是 Chipego 主要专注的两个产品,但他对所有产品的了解每天都在增长,因为他不断找到支持客户的新方法。他喜欢 Iron Software 的合作氛围,公司各地的团队成员贡献他们丰富的经验,以提供有效的创新解决方案。当 Chipego 离开办公桌时,你经常可以发现他在看书或踢足球。
< 前一页
Wkhtmltopdf C# 比较与代码示例
下一步 >
ActivePDF DocConverter 教程和对比 IronPDF