產品比較

Aspose PDF 轉換教學與比較

發佈 2024年8月11日
分享:

簡介

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平台(包括WinForms、WPF、ASP.NET和.NET Core)上創建、修改和操作PDF文件。以管理的C#編寫,Aspose.PDF強調靈活性和性能,使其適用於需要複雜PDF操作的企業級應用程序。

跨平台相容性

IronPDF 和 Aspose.PDF 都提供對 .NET framework、.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.

功能比較概述: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 所提供的功能,請訪問 IronPDF 功能.

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")
VB   C#

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")
VB   C#

IronPDF 提供用戶一個精簡且簡明的方法將 HTML 內容轉換為 PDF 文件,因其對現代網頁標準的優秀支持,使該過程變得簡單。Aspose.PDF 提供了一個強大的 API 能夠處理 HTML 到 PDF 的轉換,但這個過程可能被認為不那麼直接,需要更多步驟。

加密 PDF

在處理敏感資訊或將私密數據寫入 PDF 文件的任何環境中,能夠加密和解密 PDF 文件都是至關重要的。以下,我們比較這兩個產品如何處理此功能。 加密PDFs.

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#

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")
VB   C#

雖然兩個庫都提供強大的加密工具,但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")
VB   C#

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")
VB   C#

當涉及到在 PDF 內容進行修訂時,IronPDF 提供了一個直接的方法。其簡單直觀的 API 使用戶可以程式化地修訂內容,提高他們工作空間的效率。

儘管 Apsose.PDF 可以達到類似的結果,但該過程更為手動。在上面的程式碼範例中,它顯示了如何將您希望修訂的文本替換為「XXXXX」;如果您希望像 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")
VB   C#

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")
VB   C#

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")
VB   C#

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")
VB   C#

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")
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#

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")
VB   C#

當將文字和圖像加蓋到 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")
VB   C#

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)
VB   C#

IronPDF 提供了一種簡單直接的 DOCX 到 PDF 轉換方法,利用 ChromePdfRenderer 從 DOCX 文件生成高保真度的 PDF。這些都內建於 IronPDF 庫中,不需要額外的套件就可以將各種文件格式轉換成 PDF,然後在過程結束時保存 PDF 文件。

Aspose.PDF 本身不能直接將 DOCX 文件轉換為 PDF 格式,但需要 Aspose.Words 套件來管理轉換,然後用戶可以使用 Aspose.PDF 進一步操作 PDF 文件。

功能比較摘要

IronPDF 與 Aspose.PDF 功能比較

更多程式範例,請訪問 IronPDF 範例.

價格與授權:IronPDF vs. Aspose.PDF

在價格和授權方面, IronPDF 提供一個簡單且具成本效益的方法:

IronPDF 價格與授權

IronPDF 具有不同层级和额外功能的许可证可供购买。开发人员还可以购买 IronSuite ,讓您以兩個產品的價格獲得所有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年保障。
  • IronSuite:費用為$1,498美元,可獲得所有Iron Software產品的訪問權,包括IronPDF, IronOCR, IronWord, IronXL, IronBarcode, IronQR, IronZIP, IronPrint和IronWebScraper。

Aspose.PDF 價格

Aspose.PDF 提供多種定價方案,每個方案都有其特有的功能,且都附帶免費技術支持。開發者在使用 Aspose.PDF 時可能需要額外購買許可權,以完成某些操作,例如將 DOCX 轉換為 PDF 格式。

  • Developer Small Business:這個方案的費用為 $1,679,支持一名開發者和一個部署位置。
  • Developer OEM:這個方案的費用為 $5,037,支持一名開發者並可進行無限的部署位置支持。
  • Developer SDK:這個方案的費用為 $33,580,支持一名開發者和 50 次商業部署。
  • 附加選項:每個方案都提供兩項可隨許可證額外購買的服務,即付費支持和付費諮詢。這些附加服務的費用隨許可證類別的不同而變化,最便宜的是 Developer Small Business 計劃,其付費支持為每年 $399,付費諮詢為每位開發者每月 +$5,999。

IronPDF 提供了一個更具成本效益的解決方案,尤其是考慮到 IronSuite 套裝,它包括多個強大的庫,僅需兩個產品的價格。詳情及價格資訊,請訪問 IronPDF 授權.

授權比較表

文件和支持:IronPDF 與 Aspose.PDF

IronPDF

  • 全方位文件: 詳盡且易於使用的文件,涵蓋所有功能。
  • 24/5 支援: 提供有效的工程師支援。
  • 影片教學: YouTube 上提供逐步說明的影片指南。
  • 社群論壇: 活躍的社群可提供額外支援。
  • 定期更新: 每月產品更新,確保最新功能和安全性修補程式。

Aspose.PDF

  • 詳細文件:包含程式碼範例的全面文件。
  • 技術支援:上班時間提供標準支援。
  • 社群互動:有同儕支援的活躍論壇。
  • 培訓:提供線上培訓資料。

欲了解IronPDF文件和支援的更多詳情,請訪問 IronPDF 文件檔案 和該 IronSoftware YouTube 頻道.

結論

無論是 IronPDF 還是 Aspose.PDF.NET,當涉及到在 .NET 環境中處理 PDF 文件時,兩者都提供了廣泛的功能。每個產品都有其獨特的優勢和能力。

IronPDF 以其跨平台兼容性、對現代網頁標準如 CSS3、HTML5 和 JavaScript 的廣泛支持、簡單易用、成本效益高,以及在不需要額外套件的情況下完成各種 PDF 操作任務而自豪。當你想簡化 PDF 生成和操作任務時,IronPDF 是開發者工具箱中一個強大的工具。

IronSuite 用戶可以利用 IronPDF 與其他 IronSoftware 產品的平滑整合來實現更高級的操作。例如,用戶可以使用 IronQR 向他們的 PDF 中添加 QR 碼。 IronQR,壓縮他們的PDF文件使用 IronZIP,使用 IronPrint 列印 PDF 文件,以及執行其他各種潛在操作。

另一方面,雖然 Aspose.PDF 是一款提供豐富功能以進行複雜 PDF 操作、詳細配置並能夠在 .NET 環境中無縫運行的強大工具,但它經常需要外部套件才能完成任務。儘管如此,它擁有活躍的支持論壇,並能輕鬆執行各種 PDF 相關任務。

最終,在 IronPDF 和 Aspose.PDF 之間做出選擇取決於具體項目需求。IronPDF 提供具有競爭力的價格、詳細的文檔、響應式支持和強大的 PDF 操作工具,全都包含在一個套件中。

< 上一頁
IronPDF 與 WkHtmlToPdf C#:比較
下一個 >
ActivePDF DocConverter 教程及與 IronPDF 的比較

準備開始了嗎? 版本: 2024.10 剛剛發布

免費 NuGet 下載 總下載次數: 10,993,239 查看許可證 >