產品比較

Syncfusion PDF Viewer 與 HTML 轉 PDF 的比較

發佈 2024年8月11日
分享:

簡介

一個良好且簡單的 PDF 操作工具可以簡化許多與 PDF 生成功修改相關的過程和任務。在 .NET 框架中,IronPDF 和 Syncfusion 是兩個強大的庫,用於在不依賴 Adobe 的情況下創建、編輯和轉換 PDF 文件。本文將根據它們各自的特點、文檔和許可費用來比較 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 框架內處理 PDF。基於這個原因,我們將概述每個產品在框架和平台方面的支持情況。

IronPDF:

  • .NET 版本: (C#, VB.NET, F#)

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

    • .NET標準 (2.0+)
  • .NET Framework (4.6.2+)
  • 應用環境: IronPDF 適用於包括 Windows、Linux、Mac、Docker、Azure 和 AWS 在內的應用環境
  • 集成開發環境 (IDEs): 適用於 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 時,可能需要將它們從不同的格式進行轉換。在這種情況下,我們將看看 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 具有不同层级和额外功能的许可证可供购买。开发人员还可以购买 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。

Syncfusion 價格和授權

Syncfusion 提供多種授權和等級,以滿足不同開發人員的需求。每種類型的授權都包含 24 小時支援、遠程支援存取、無限的錯誤和功能請求以及線上支援系統。

  • 團隊授權: 團隊授權是針對開發人員團隊的授權,並且在這個範圍內有三個等級。

    • 最多 5 名開發人員的團隊: 每月 $395 美元

    • 最多 10 名開發人員的團隊: 每月 $695 美元
  • 超過 10 名開發人員的團隊: 此等級沒有設定價格,需要請求報價
  • 無限授權: 這些授權等級沒有設定價格,而是根據報價系統運行。

    • 專案授權: 一個命名的專案或應用程式

    • 全球授權: 公司內部允許所有開發人員存取
  • 部門授權: 公司的一個部門從事多個專案
  • 社區授權: Syncfusion 的授權軟體為年度總收入少於 100 萬美元、開發人員少於或等於 5 人、總員工少於或等於 10 人的公司和用戶提供社區授權。

授權比較表

文件與支援:IronPDF 對比 Syncfusion

IronPDF

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

Syncfusion

  • 論壇: 提供社區論壇以促進和學習社區內的交流。
  • 教程: Syncfusion 提供在其知識庫中的教程和指南。
  • 功能和錯誤: 用戶可以提交有關產品的反饋意見,當遇到錯誤時,可以提交支援票。
  • 資源: Syncfusion 提供電子書、網路研討會、技術常見問題等。

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

結論

總之,在選擇適用於 .NET Core 的 PDF 操作庫時,IronPDF 脫穎而出。其廣泛的功能集、易用性以及全面的支援和文件使其成為開發者的理想選擇。IronPDF 在多個方面表現出色,例如 HTML 到 PDF 的轉換、加密、修訂、數位簽名和浮水印,為這些任務提供了簡化且高效的解決方案。此外,IronPDF 的價格和授權選項更加簡單明瞭,能夠很好地滿足不同團隊規模和項目需求,使其成為許多開發者的具成本效益選擇。

另一方面,儘管 Syncfusion PDF 適用於 .NET Core 是一個功能強大的庫,但通常需要更陡峭的學習曲線以及更多的手動操作來完成類似的任務。Syncfusion 提供了豐富的功能範圍,但缺乏 IronPDF 所具備的直觀性和靈活性。然而,您可以將其與其他 Syncfusion 工具結合使用來進一步擴展其技能集,例如其 ASP.NET PDF Viewer 或 Syncfusion Word。

對於那些尋找可靠、強大且使用者友好的 .NET 框架內 PDF 庫的人而言,IronPDF 是明顯的選擇。其強大的功能性、用戶支持和靈活的授權選項的結合,使其成為任何處理 PDF 的開發者不可或缺的工具。

< 上一頁
iTextSharp C# HTML 轉 PDF 的 .NET Core 替代方案
下一個 >
IronPDF 與 WkHtmlToPdf C#:比較

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

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