產品比較

IronPDF 和 EvoPdf:比較

發佈 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# 編寫並支持 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。
  • IDEs: 支援使用 Microsoft Visual Studio 和 JetBrains Rider & ReSharper 等 IDEs。
  • 作業系統和處理器: 支援多種不同的作業系統和處理器,包括 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 to 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")
VB   C#

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

HTML 轉換為 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")
VB   C#

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

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

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

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

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

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

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

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

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擁有不同的等級和額外功能可供購買許可證。 開發人員還可以購買IronSuite這使您能以兩個產品的價格訪問所有 Iron Software 的產品。 如果您還沒準備好購買許可證,IronPDF 提供一個免費試用因此,您可以在承諾購買許可證之前探索其提供的所有功能。

  • 永久授權: 提供多種永久授權類型,根據您的團隊規模、專案需求和地點數量選擇。 每種授權類型均提供電子郵件支援。
  • Lite License(輕量授權):此授權費用為 $749,支援一位開發者、一個地點和一個專案。
  • Plus License: 支援三位開發人員、三個地點和三個專案,這是比Lite License更高級的選擇,費用為1,499美元。Plus 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.

    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 轉換器適用於所有平台: 這只是單獨的產品,如果您只需要 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 Software網站上,您可以在其線上演示部分測試該庫提供的所有功能。
  • 技術支援: 您可以通過網站上提供的電子郵件和電話詳細資訊聯繫團隊,獲得技術和非技術支援。

結論

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

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

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

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

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

免費 NuGet 下載 總下載次數: 11,622,374 查看許可證 >