產品比較

IronPDF 和 EvoPdf:比較

Chipego
奇佩戈·卡林达
2024年9月29日
分享:

IronPDF 和 EvoPdf 是兩個用於創建、編輯和管理 PDF 文件的知名 .NET 庫。 每個都有獨特的優勢和功能,專為在 .NET 平台上工作的開發者量身打造。 本文將深入比較這兩個庫,重點介紹它們的功能、兼容性、許可證、支持等。

希望在閱讀本文後,您能夠識別最適合您 PDF 需求的函式庫,並且如果您想要探索更多 PDF 函式庫選項,能夠進行自己的比較。

IronPDF 和 EvoPdf 概覽

IronPDF 是一個 .NET PDF 函式庫,可讓開發人員以程式方式創建、編輯和操作 PDF 文件。 以其易於使用、廣泛兼容.NET版本以及能夠將HTML、ASPX和圖像文件轉換為PDF的能力而著稱,同時保持對原始內容的高度忠實度。 IronPDF 的廣泛文件記錄、強大的客戶支持及豐富的功能集,使其成為尋求將 PDF 功能整合到 .NET 應用程序中的開發者的首選。

EvoPdf 是另一個 .NET 函式庫,專為 HTML 到 PDF 轉換及其他 PDF 操作任務而設計。 它提供對 HTML 標籤、CSS、JavaScript 及其他現代網頁技術的高級支援,從而能夠從網頁內容生成高品質的 PDF 文件。 EvoPdf 因其渲染能力和對網頁標準的廣泛支持而受到讚賞,這使得它成為專注於網頁轉PDF轉換的開發人員的寶貴工具。

跨平台相容性

IronPDF

IronPDF 提供廣泛的跨平台兼容性,使其成為適用於各種環境的多功能工具:

  • .NET 版本:

    • 完全用 C# 編寫並支援 VB.NET 和 F#

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

    • .NET Standard (2.0+)
  • .NET Framework (4.6.2+)
  • 應用環境:IronPDF 可在多種應用環境中運行,如 Windows、Linux、Mac、Docker、Azure 和 AWS。
  • IDE:可與 Microsoft Visual Studio 和 JetBrains Rider & ReSharper 等 IDE 一起使用
  • 作業系統和處理器:支援多種不同的作業系統和處理器,包括 Windows、Mac、Linux、x64、x86、ARM

    如需有關 IronPDF 相容性的更多詳細資訊,請造訪IronPDF 相容性

EvoPdf

  • .NET 版本:

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

    • .NET Standard 2.0+
  • .NET Framework (4.8.1, 4.7.2, 4.6.1 和 4.0+)
  • 應用環境:EvoPdf 可以在 Windows、Linux、Mac、Azure 雲服務及其他平台上運行。

關鍵功能比較:IronPDF 與 EvoPdf 的 PDF 功能

IronPDF 和 EvoPdf 都提供強大的 PDF 操作功能,但開發人員應該考慮一些明顯的差異:

IronPDF

  • PDF 轉換:IronPDF 可以從 HTML 內容生成 PDF 文件。 IronPDF 完全支援現代網頁標準,您可以確信它能從您的 HTML 內容中一致地生成像素完美的 PDF。 IronPDF 也可以將其他格式如 DOCX、圖片、RTF 等轉換為 PDF 文件。
  • PDF 生成:使用 IronPDF,您可以從 URL、ASPX 文件或 HTML 字符串生成 PDF。
  • 安全特性:使用 IronPDF,您可以始終確保任何敏感的 PDF 文件是安全的,這要歸功於它的安全特性。 使用 IronPDF 加密您的 PDF 檔案,設定密碼,並為您的 PDF 檔案設定許可權。
  • PDF 編輯功能:使用 IronPDF,您可以處理現有的 PDF 文件、編輯它們,並輕鬆閱讀 PDF 文件。 IronPDF 提供編輯功能,例如添加頁首和頁尾、將文字和圖片蓋印到 PDF 頁面上、在 PDF 中添加自訂浮水印、處理 PDF 表單,以及拆分或合併 PDF 文件。
  • 整合:無縫整合 ASP.NET和MVC應用程式。

    如需完整的 IronPDF 功能列表,請造訪 IronPDF 功能

EvoPdf

  • HTML 到 PDF 轉換器:這是 EvoPdf 專注的主要功能,具有對現代網頁標準的高級支持,可以將 HTML 內容轉換為 PDF 格式。
  • PDF 安全性:透過利用 EvoPdf 的 EvoPdf Chromium for .NET 庫,您可以建立具有安全功能和數位簽章的 PDF 文件。
  • HTML 轉換:將網頁、HTML 內容和 HTML 字串轉換為各種文件類型,不僅僅是 PDF,還包括點陣圖和 SVG 向量圖。
  • PDF 操作:使用 EvoPdf,您可以修改現有的 PDF 文檔、合併它們、分割它們,並填寫現有的 PDF 文檔及其表單。

IronPDF 與 EvoPdf 的頂級亮點功能對比及代碼範例

以下是 IronPDF 和 EvoPdf 之間頂級功能的詳細比較,並附有具體的程式碼範例來展示它們的使用方法。

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

// Export to a file or Stream
pdf.SaveAs("output.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>");

// Export to a file or Stream
pdf.SaveAs("output.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>")

' Export to a file or Stream
pdf.SaveAs("output.pdf")
$vbLabelText   $csharpLabel

EvoPdf

using EvoPdf;

// create the converter object in your code where you want to run conversion
HtmlToPdfConverter converter = new HtmlToPdfConverter();

// convert the HTML string to a PDF file
converter.ConvertHtmlToFile("<b>Hello World</b> from EVO PDF !", null, "HtmlToFile.pdf");

// convert HTML pages from URL to a PDF file
string htmlPageURL = "http://www.evopdf.com";
converter.ConvertUrlToFile(htmlPageURL, "UrlToFile.pdf");
using EvoPdf;

// create the converter object in your code where you want to run conversion
HtmlToPdfConverter converter = new HtmlToPdfConverter();

// convert the HTML string to a PDF file
converter.ConvertHtmlToFile("<b>Hello World</b> from EVO PDF !", null, "HtmlToFile.pdf");

// convert HTML pages from URL to a PDF file
string htmlPageURL = "http://www.evopdf.com";
converter.ConvertUrlToFile(htmlPageURL, "UrlToFile.pdf");
Imports EvoPdf

' create the converter object in your code where you want to run conversion
Private converter As New HtmlToPdfConverter()

' convert the HTML string to a PDF file
converter.ConvertHtmlToFile("<b>Hello World</b> from EVO PDF !", Nothing, "HtmlToFile.pdf")

' convert HTML pages from URL to a PDF file
Dim htmlPageURL As String = "http://www.evopdf.com"
converter.ConvertUrlToFile(htmlPageURL, "UrlToFile.pdf")
$vbLabelText   $csharpLabel

HTML to PDF 轉換 是一項常見的 PDF 相關任務,正如您在上面的代碼示例中所見,IronPDF 和 EvoPdf 都可以輕鬆處理這項工作。 IronPDF 提供像素完美的 HTML 內容渲染,這要歸功於其現代網頁支持,因此您只需幾行代碼即可創建 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
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
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
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

EvoPdf

PdfSecurityOptions securityOptions = new PdfSecurityOptions();

securityOptions.CanAssembleDocument = canAssembleDocument;
securityOptions.CanCopyContent = canCopyContent;
securityOptions.CanEditAnnotations = canEditAnnotations;
securityOptions.CanEditContent = canEditContent;
securityOptions.CanFillFormFields = canFillFormFields;
securityOptions.CanPrint = canPrint;
securityOptions.KeySize = keySize;
securityOptions.UserPassword = userPassword;
securityOptions.OwnerPassword = ownerPassword;

PdfSecurityManager securityManager = new PdfSecurityManager(securityOptions);

if (removeSecurity)
    securityManager.SaveUnSecuredPdfToFile(srcPdfFile, outFile, removeSecurityPswd);
else
    securityManager.SaveSecuredPdfToFile(srcPdfFile, outFile);
PdfSecurityOptions securityOptions = new PdfSecurityOptions();

securityOptions.CanAssembleDocument = canAssembleDocument;
securityOptions.CanCopyContent = canCopyContent;
securityOptions.CanEditAnnotations = canEditAnnotations;
securityOptions.CanEditContent = canEditContent;
securityOptions.CanFillFormFields = canFillFormFields;
securityOptions.CanPrint = canPrint;
securityOptions.KeySize = keySize;
securityOptions.UserPassword = userPassword;
securityOptions.OwnerPassword = ownerPassword;

PdfSecurityManager securityManager = new PdfSecurityManager(securityOptions);

if (removeSecurity)
    securityManager.SaveUnSecuredPdfToFile(srcPdfFile, outFile, removeSecurityPswd);
else
    securityManager.SaveSecuredPdfToFile(srcPdfFile, outFile);
Dim securityOptions As New PdfSecurityOptions()

securityOptions.CanAssembleDocument = canAssembleDocument
securityOptions.CanCopyContent = canCopyContent
securityOptions.CanEditAnnotations = canEditAnnotations
securityOptions.CanEditContent = canEditContent
securityOptions.CanFillFormFields = canFillFormFields
securityOptions.CanPrint = canPrint
securityOptions.KeySize = keySize
securityOptions.UserPassword = userPassword
securityOptions.OwnerPassword = ownerPassword

Dim securityManager As New PdfSecurityManager(securityOptions)

If removeSecurity Then
	securityManager.SaveUnSecuredPdfToFile(srcPdfFile, outFile, removeSecurityPswd)
Else
	securityManager.SaveSecuredPdfToFile(srcPdfFile, outFile)
End If
$vbLabelText   $csharpLabel

IronPDF 提供了一個全面的 API 來管理加密設置,同時讓您完全控制該過程和各種安全設置。 EvoPdf 的加密工具在過程中提供了類似的控制水平,使其成為 PDF 加密的另一個強有力的競爭者。

編輯 PDF 內容

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

EvoPdf:缺乏內建的文字修訂功能。

IronPDF 為您提供了一個強大的 PDF 編輯工具,可以僅用幾行代碼就從您的 PDF 文件中編輯指定內容。 另一方面,EvoPdf 不提供任何內建的 PDF 修訂工具。

數位簽署 PDF 文件

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

EvoPdf

protected void convertToPdfButton_Click(object sender, EventArgs e)
{
    // Create a HTML to PDF converter object with default settings
    HtmlToPdfConverter htmlToPdfConverter = new HtmlToPdfConverter();

    // Set license key received after purchase to use the converter in licensed mode
    // Leave it not set to use the converter in demo mode
    htmlToPdfConverter.LicenseKey = "4W9+bn19bn5ue2B+bn1/YH98YHd3d3c=";

    Document pdfDocument = null;
    try
    {
        string htmlWithDigitalSignatureMarker = htmlStringTextBox.Text;
        string baseUrl = baseUrlTextBox.Text;

        // Convert a HTML string with a marker for digital signature to a PDF document object
        pdfDocument = htmlToPdfConverter.ConvertHtmlToPdfDocumentObject(htmlWithDigitalSignatureMarker, baseUrl);

        // Make the HTML element with 'digital_signature_element' mapping ID a link to digital signature properties
        HtmlElementMapping digitalSignatureMapping = htmlToPdfConverter.HtmlElementsMappingOptions.HtmlElementsMappingResult.GetElementByMappingId("digital_signature_element");
        if (digitalSignatureMapping != null)
        {
            PdfPage digitalSignaturePage = digitalSignatureMapping.PdfRectangles[0].PdfPage;
            RectangleF digitalSignatureRectangle = digitalSignatureMapping.PdfRectangles[0].Rectangle;

            string certificateFilePath = Server.MapPath("~/DemoAppFiles/Input/Certificates/evopdf.pfx");

            // Get the certificate from password protected PFX file
            DigitalCertificatesCollection certificates = DigitalCertificatesStore.GetCertificates(certificateFilePath, "evopdf");
            DigitalCertificate certificate = certificates[0];

            // Create the digital signature
            DigitalSignatureElement signature = new DigitalSignatureElement(digitalSignatureRectangle, certificate);
            signature.Reason = "Protect the document from unwanted changes";
            signature.ContactInfo = "The contact email is support@evopdf.com";  
            signature.Location = "Development server";
            digitalSignaturePage.AddElement(signature);
        }

        // Save the PDF document in a memory buffer
        byte[] outPdfBuffer = pdfDocument.Save();

        // Send the PDF as response to browser

        // Set response content type
        Response.AddHeader("Content-Type", "application/pdf");

        // Instruct the browser to open the PDF file as an attachment or inline
        Response.AddHeader("Content-Disposition", String.Format("attachment; filename=Digital_Signatures.pdf; size={0}", outPdfBuffer.Length.ToString()));

        // Write the PDF document buffer to HTTP response
        Response.BinaryWrite(outPdfBuffer);

        // End the HTTP response and stop the current page processing
        Response.End();
    }
    finally
    {
        // Close the PDF document
        if (pdfDocument != null)
            pdfDocument.Close();
    }
}
protected void convertToPdfButton_Click(object sender, EventArgs e)
{
    // Create a HTML to PDF converter object with default settings
    HtmlToPdfConverter htmlToPdfConverter = new HtmlToPdfConverter();

    // Set license key received after purchase to use the converter in licensed mode
    // Leave it not set to use the converter in demo mode
    htmlToPdfConverter.LicenseKey = "4W9+bn19bn5ue2B+bn1/YH98YHd3d3c=";

    Document pdfDocument = null;
    try
    {
        string htmlWithDigitalSignatureMarker = htmlStringTextBox.Text;
        string baseUrl = baseUrlTextBox.Text;

        // Convert a HTML string with a marker for digital signature to a PDF document object
        pdfDocument = htmlToPdfConverter.ConvertHtmlToPdfDocumentObject(htmlWithDigitalSignatureMarker, baseUrl);

        // Make the HTML element with 'digital_signature_element' mapping ID a link to digital signature properties
        HtmlElementMapping digitalSignatureMapping = htmlToPdfConverter.HtmlElementsMappingOptions.HtmlElementsMappingResult.GetElementByMappingId("digital_signature_element");
        if (digitalSignatureMapping != null)
        {
            PdfPage digitalSignaturePage = digitalSignatureMapping.PdfRectangles[0].PdfPage;
            RectangleF digitalSignatureRectangle = digitalSignatureMapping.PdfRectangles[0].Rectangle;

            string certificateFilePath = Server.MapPath("~/DemoAppFiles/Input/Certificates/evopdf.pfx");

            // Get the certificate from password protected PFX file
            DigitalCertificatesCollection certificates = DigitalCertificatesStore.GetCertificates(certificateFilePath, "evopdf");
            DigitalCertificate certificate = certificates[0];

            // Create the digital signature
            DigitalSignatureElement signature = new DigitalSignatureElement(digitalSignatureRectangle, certificate);
            signature.Reason = "Protect the document from unwanted changes";
            signature.ContactInfo = "The contact email is support@evopdf.com";  
            signature.Location = "Development server";
            digitalSignaturePage.AddElement(signature);
        }

        // Save the PDF document in a memory buffer
        byte[] outPdfBuffer = pdfDocument.Save();

        // Send the PDF as response to browser

        // Set response content type
        Response.AddHeader("Content-Type", "application/pdf");

        // Instruct the browser to open the PDF file as an attachment or inline
        Response.AddHeader("Content-Disposition", String.Format("attachment; filename=Digital_Signatures.pdf; size={0}", outPdfBuffer.Length.ToString()));

        // Write the PDF document buffer to HTTP response
        Response.BinaryWrite(outPdfBuffer);

        // End the HTTP response and stop the current page processing
        Response.End();
    }
    finally
    {
        // Close the PDF document
        if (pdfDocument != null)
            pdfDocument.Close();
    }
}
Protected Sub convertToPdfButton_Click(ByVal sender As Object, ByVal e As EventArgs)
	' Create a HTML to PDF converter object with default settings
	Dim htmlToPdfConverter As New HtmlToPdfConverter()

	' Set license key received after purchase to use the converter in licensed mode
	' Leave it not set to use the converter in demo mode
	htmlToPdfConverter.LicenseKey = "4W9+bn19bn5ue2B+bn1/YH98YHd3d3c="

	Dim pdfDocument As Document = Nothing
	Try
		Dim htmlWithDigitalSignatureMarker As String = htmlStringTextBox.Text
		Dim baseUrl As String = baseUrlTextBox.Text

		' Convert a HTML string with a marker for digital signature to a PDF document object
		pdfDocument = htmlToPdfConverter.ConvertHtmlToPdfDocumentObject(htmlWithDigitalSignatureMarker, baseUrl)

		' Make the HTML element with 'digital_signature_element' mapping ID a link to digital signature properties
		Dim digitalSignatureMapping As HtmlElementMapping = htmlToPdfConverter.HtmlElementsMappingOptions.HtmlElementsMappingResult.GetElementByMappingId("digital_signature_element")
		If digitalSignatureMapping IsNot Nothing Then
			Dim digitalSignaturePage As PdfPage = digitalSignatureMapping.PdfRectangles(0).PdfPage
			Dim digitalSignatureRectangle As RectangleF = digitalSignatureMapping.PdfRectangles(0).Rectangle

			Dim certificateFilePath As String = Server.MapPath("~/DemoAppFiles/Input/Certificates/evopdf.pfx")

			' Get the certificate from password protected PFX file
			Dim certificates As DigitalCertificatesCollection = DigitalCertificatesStore.GetCertificates(certificateFilePath, "evopdf")
			Dim certificate As DigitalCertificate = certificates(0)

			' Create the digital signature
			Dim signature As New DigitalSignatureElement(digitalSignatureRectangle, certificate)
			signature.Reason = "Protect the document from unwanted changes"
			signature.ContactInfo = "The contact email is support@evopdf.com"
			signature.Location = "Development server"
			digitalSignaturePage.AddElement(signature)
		End If

		' Save the PDF document in a memory buffer
		Dim outPdfBuffer() As Byte = pdfDocument.Save()

		' Send the PDF as response to browser

		' Set response content type
		Response.AddHeader("Content-Type", "application/pdf")

		' Instruct the browser to open the PDF file as an attachment or inline
		Response.AddHeader("Content-Disposition", String.Format("attachment; filename=Digital_Signatures.pdf; size={0}", outPdfBuffer.Length.ToString()))

		' Write the PDF document buffer to HTTP response
		Response.BinaryWrite(outPdfBuffer)

		' End the HTTP response and stop the current page processing
		Response.End()
	Finally
		' Close the PDF document
		If pdfDocument IsNot Nothing Then
			pdfDocument.Close()
		End If
	End Try
End Sub
$vbLabelText   $csharpLabel

IronPDF 提供了一個強大的 API,用於將數位簽名應用於您的 PDF 文件,同時使這個過程簡單易懂。 EvoPdf 提供基本的簽名支持,但缺乏 IronPDF 所提供的廣泛選項,並且採用了手動且更複雜的方法。

將自訂浮水印應用於 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

EvoPdf

protected void convertToPdfButton_Click(object sender, EventArgs e)
{
    // Create a HTML to PDF converter object with default settings
    HtmlToPdfConverter htmlToPdfConverter = new HtmlToPdfConverter();

    htmlToPdfConverter.LicenseKey = "4W9+bn19bn5ue2B+bn1/YH98YHd3d3c=";

    Document pdfDocument = null;
    try
    {
        // Convert a HTML page to a PDF document object
        pdfDocument = htmlToPdfConverter.ConvertUrlToPdfDocumentObject(urlTextBox.Text);

        // Get the stamp width and height
        float stampWidth = float.Parse(stampWidthTextBox.Text);
        float stampHeight = float.Parse(stampHeightTextBox.Text);

        // Center the stamp at the top of PDF page
        float stampXLocation = (pdfDocument.Pages[0].ClientRectangle.Width - stampWidth) / 2;
        float stampYLocation = 0;

        RectangleF stampRectangle = new RectangleF(stampXLocation, stampYLocation, stampWidth, stampHeight);

        // Create the stamp template to be repeated in each PDF page
        Template stampTemplate = pdfDocument.AddTemplate(stampRectangle);

        // Create the HTML element to add in stamp template
        HtmlToPdfElement stampHtmlElement = new HtmlToPdfElement(htmlStringTextBox.Text, baseUrlTextBox.Text);

        // Set the HTML viewer width for the HTML added in stamp
        stampHtmlElement.HtmlViewerWidth = 600;
        // Fit the HTML content in stamp template
        stampHtmlElement.FitWidth = true;
        stampHtmlElement.FitHeight = true;

        // Add HTML to stamp template
        stampTemplate.AddElement(stampHtmlElement);

        // Save the PDF document in a memory buffer
        byte[] outPdfBuffer = pdfDocument.Save();

        // Send the PDF as response to browser
        // Set response content type
        Response.AddHeader("Content-Type", "application/pdf");

        // Instruct the browser to open the PDF file as an attachment or inline
        Response.AddHeader("Content-Disposition", String.Format("attachment; filename=Watermarks_and_Stamps.pdf; size={0}", outPdfBuffer.Length.ToString()));

        // Write the PDF document buffer to HTTP response
        Response.BinaryWrite(outPdfBuffer);

        // End the HTTP response and stop the current page processing
        Response.End();
    }
    finally
    {
        // Close the PDF document
        if (pdfDocument != null)
            pdfDocument.Close();
    }
}
protected void convertToPdfButton_Click(object sender, EventArgs e)
{
    // Create a HTML to PDF converter object with default settings
    HtmlToPdfConverter htmlToPdfConverter = new HtmlToPdfConverter();

    htmlToPdfConverter.LicenseKey = "4W9+bn19bn5ue2B+bn1/YH98YHd3d3c=";

    Document pdfDocument = null;
    try
    {
        // Convert a HTML page to a PDF document object
        pdfDocument = htmlToPdfConverter.ConvertUrlToPdfDocumentObject(urlTextBox.Text);

        // Get the stamp width and height
        float stampWidth = float.Parse(stampWidthTextBox.Text);
        float stampHeight = float.Parse(stampHeightTextBox.Text);

        // Center the stamp at the top of PDF page
        float stampXLocation = (pdfDocument.Pages[0].ClientRectangle.Width - stampWidth) / 2;
        float stampYLocation = 0;

        RectangleF stampRectangle = new RectangleF(stampXLocation, stampYLocation, stampWidth, stampHeight);

        // Create the stamp template to be repeated in each PDF page
        Template stampTemplate = pdfDocument.AddTemplate(stampRectangle);

        // Create the HTML element to add in stamp template
        HtmlToPdfElement stampHtmlElement = new HtmlToPdfElement(htmlStringTextBox.Text, baseUrlTextBox.Text);

        // Set the HTML viewer width for the HTML added in stamp
        stampHtmlElement.HtmlViewerWidth = 600;
        // Fit the HTML content in stamp template
        stampHtmlElement.FitWidth = true;
        stampHtmlElement.FitHeight = true;

        // Add HTML to stamp template
        stampTemplate.AddElement(stampHtmlElement);

        // Save the PDF document in a memory buffer
        byte[] outPdfBuffer = pdfDocument.Save();

        // Send the PDF as response to browser
        // Set response content type
        Response.AddHeader("Content-Type", "application/pdf");

        // Instruct the browser to open the PDF file as an attachment or inline
        Response.AddHeader("Content-Disposition", String.Format("attachment; filename=Watermarks_and_Stamps.pdf; size={0}", outPdfBuffer.Length.ToString()));

        // Write the PDF document buffer to HTTP response
        Response.BinaryWrite(outPdfBuffer);

        // End the HTTP response and stop the current page processing
        Response.End();
    }
    finally
    {
        // Close the PDF document
        if (pdfDocument != null)
            pdfDocument.Close();
    }
}
Protected Sub convertToPdfButton_Click(ByVal sender As Object, ByVal e As EventArgs)
	' Create a HTML to PDF converter object with default settings
	Dim htmlToPdfConverter As New HtmlToPdfConverter()

	htmlToPdfConverter.LicenseKey = "4W9+bn19bn5ue2B+bn1/YH98YHd3d3c="

	Dim pdfDocument As Document = Nothing
	Try
		' Convert a HTML page to a PDF document object
		pdfDocument = htmlToPdfConverter.ConvertUrlToPdfDocumentObject(urlTextBox.Text)

		' Get the stamp width and height
		Dim stampWidth As Single = Single.Parse(stampWidthTextBox.Text)
		Dim stampHeight As Single = Single.Parse(stampHeightTextBox.Text)

		' Center the stamp at the top of PDF page
		Dim stampXLocation As Single = (pdfDocument.Pages(0).ClientRectangle.Width - stampWidth) / 2
		Dim stampYLocation As Single = 0

		Dim stampRectangle As New RectangleF(stampXLocation, stampYLocation, stampWidth, stampHeight)

		' Create the stamp template to be repeated in each PDF page
		Dim stampTemplate As Template = pdfDocument.AddTemplate(stampRectangle)

		' Create the HTML element to add in stamp template
		Dim stampHtmlElement As New HtmlToPdfElement(htmlStringTextBox.Text, baseUrlTextBox.Text)

		' Set the HTML viewer width for the HTML added in stamp
		stampHtmlElement.HtmlViewerWidth = 600
		' Fit the HTML content in stamp template
		stampHtmlElement.FitWidth = True
		stampHtmlElement.FitHeight = True

		' Add HTML to stamp template
		stampTemplate.AddElement(stampHtmlElement)

		' Save the PDF document in a memory buffer
		Dim outPdfBuffer() As Byte = pdfDocument.Save()

		' Send the PDF as response to browser
		' Set response content type
		Response.AddHeader("Content-Type", "application/pdf")

		' Instruct the browser to open the PDF file as an attachment or inline
		Response.AddHeader("Content-Disposition", String.Format("attachment; filename=Watermarks_and_Stamps.pdf; size={0}", outPdfBuffer.Length.ToString()))

		' Write the PDF document buffer to HTTP response
		Response.BinaryWrite(outPdfBuffer)

		' End the HTTP response and stop the current page processing
		Response.End()
	Finally
		' Close the PDF document
		If pdfDocument IsNot Nothing Then
			pdfDocument.Close()
		End If
	End Try
End Sub
$vbLabelText   $csharpLabel

IronPDF 提供了一個簡潔而強大的 PDF 浮水印工具,讓您可以輕鬆地為 PDF 文件應用自訂浮水印,而不需要太多的設置。相比之下,EvoPdf 則需要投入相當多的精力來設置浮水印工具,使其成為一個不太精簡的選擇。

將圖像和文本加蓋到 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

EvoPdf:對圖像和文字標記的支援有限,使用與其浮水印功能相同的工具。

IronPDF 提供詳細且靈活的方法來向 PDF 添加文字和圖像標籤,其蓋章工具易於使用,實現所需的代碼也很少。 EvoPdf 在將文字加蓋到您的 PDF 頁面之前需要進行更多設定。

DOCX 轉 PDF C#

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

EvoPdf:您需要使用 Evo Work to PDF 轉換器庫來將 DOCX 文件轉換為 PDF 格式。

IronPDF 提供直觀的 API 進行 DOCX 到 PDF 的轉換,使處理不同文件類型更為容易。使用 EvoPdf 時,您需要確保已安裝 Evo Word to PDF 工具才能執行此任務。

程式範例比較摘要

Evopdf Net Core Alternatives Html To Pdf 1 related to 程式範例比較摘要

要了解 IronPDF 提供的豐富功能,並親眼見證其運作,請查看 IronPDF 使用指南,該指南深入探討每個功能,探索其如何運作,並賦予您成為 PDF 專家的技能。

定價和授權:IronPDF 與 EvoPdf Library 比較

IronPDF

IronPDF 有不同級別和額外功能可供購買許可證。 開發人員也可以購買 Iron Suite,以兩個產品的價格獲得 Iron Software 所有產品的使用權。 如果您還沒有準備好購買授權,IronPDF 提供免費試用,以便您在決定購買授權之前探索其提供的所有功能。

  • 永久許可證:根據您的團隊規模、專案需求和地點數量,提供一系列永久許可證。 每種授權類型均提供電子郵件支援。
  • Lite License:此授权费用为$749,支持一名开发人员、一个地点和一个项目。
  • Plus License: 支援三位開發人員、三個地點和三個項目,這是比 Lite License 更進一步的選擇,費用為 $1,499。Plus License 除了基本的電子郵件支援,還提供聊天支援和電話支援。
  • Professional License:此許可證適用於較大的團隊,支持十名開發人員、十個地點和十個項目,價格為 $2,999。它提供與先前層級相同的聯繫支持渠道,此外還提供螢幕共享支持。
  • 免版稅重發:IronPDF 的許可證還提供免版稅重發保障,額外收費 $1,999
  • 不中斷的產品支援:IronPDF 提供持續的產品更新、安全功能升級以及來自其工程團隊的支援,價格為每年 $999,或一次性支付 $1,999 即可獲得 5 年的保障。
  • Iron Suite:只需 $1,498,即可使用所有 Iron Software 產品,包括 IronPDFIronOCRIronWordIronXLIronBarcodeIronQRIronZIPIronPrintIronWebScraper

    Evopdf Net Core Alternatives Html To Pdf 2 related to IronPDF

EvoPdf

EvoPdf的授權基於兩種模式:部署授權和公司授權。 這兩個選項都提供永久許可,並在第一年提供技術支援和軟體更新。

  • EVO PDF 工具包:這個工具包包含與此產品相關的所有工具,例如:HTML 到 PDF 轉換器、EvoPdf Chromium、Word 到 PDF 轉換器、Excel 到 PDF 轉換器等。 此授權的部署版本價格為$650,公司版本價格為$1400。
  • 適用於所有平台的 EVO HTML to PDF Converter:這只是單一產品,如果您只需要 HTML to PDF 工具,可以單獨購買,而不必購買 EVO PDF 工具包。 這個部署版本的費用為 $450,公司版本的費用為 $1200。

文件及支援:IronPDF對比EvoPdf

IronPDF

IronPDF自豪於其廣泛且詳細的文件和開發者支持。

  • 綜合文件:涵蓋所有功能的廣泛且易於使用的文件。
  • 24/5 支援:提供現役工程師支持。
  • 影片教學:在 YouTube 上提供逐步的影片指南。
  • 社區論壇:活躍的社群提供額外支持。
  • 定期更新:每月產品更新,確保最新功能和安全修補程式。
  • PDF API 參考: 提供 API 參考資料,讓您可以充分利用我們工具的所有功能。

    如需更多資訊,請查看 IronPDF 詳細的文件,並訪問Iron Software YouTube 頻道

EvoPdf

  • 文件: EvoPdf 提供其功能的文件,但如果您不熟悉該網站,可能會較難瀏覽。
  • 即時演示: 在EVO PDF軟體網站,您可以通過其即時演示區域測試該庫提供的所有功能。
  • 技術支援:您可以通過網站上提供的電子郵件和電話詳細信息聯繫團隊以獲得技術和非技術方面的支援。

結論

IronPDF 和 EvoPdf 都是適合 .NET 開發者使用的強大 PDF 函式庫。 然而,IronPDF 的廣泛功能集、強大的跨平台相容性、靈活的授權選擇,以及優秀的文件和支援,讓它成為大多數開發專案的一個更具吸引力的選擇。 使用 IronPDF,您可以輕鬆處理任何與 PDF 有關的任務,因為您隨時擁有強大且豐富的功能集。

EvoPdf 是一個穩固的替代方案,特別適合那些專門尋找專注於 HTML 到 PDF 轉換工具且不想要更高階庫附帶許多附加功能的人,同時仍然可以選擇通過購買完整工具包來添加和移除功能。

您可以嘗試30天免費試用來查看他們的可用功能。

Chipego
奇佩戈·卡林达
軟體工程師
Chipego 擁有天生的傾聽技能,這幫助他理解客戶問題,並提供智能解決方案。他在獲得信息技術理學學士學位後,于 2023 年加入 Iron Software 團隊。IronPDF 和 IronOCR 是 Chipego 專注的兩個產品,但隨著他每天找到新的方法來支持客戶,他對所有產品的了解也在不斷增長。他喜歡在 Iron Software 的協作生活,公司內的團隊成員從各自不同的經歷中共同努力,創造出有效的創新解決方案。當 Chipego 離開辦公桌時,他常常享受讀好書或踢足球的樂趣。
< 上一頁
IronPDF與SelectPDF之比較
下一個 >
iTextSharp C# HTML 轉 PDF 的 .NET Core 替代方案