產品比較

IronPDF與HiQPdf C#的比較

Chipego
奇佩戈·卡林达
2022年4月10日
已更新 2024年11月12日
分享:

IronPDF 和 HiQPdf 概述

對於使用 .NET 的開發人員來說,找到合適的 PDF 解決方案對於構建功能豐富的應用程式至關重要。 在當今的現代時代,隨著提供 PDF 轉換技術的產品數量不斷增加,找到合適的工具來滿足您的需求可能會很困難。 在此比較中,我們將評估IronPDFHiQPdf,這是兩個在.NET專案中使用的流行HTML轉PDF庫。 雖然這兩個程式庫都提供強大的 PDF 生成功能,但IronPDF因其更全面的功能、跨平台相容性和直觀的 API 而脫穎而出。

無論您在尋找進階編輯選項、跨平台支援,或是使用方便性,此 IronPDF 與 HiQPdf 的並排比較將幫助您做出明智的選擇。

主要功能一覽

IronPDF 是一個多功能的 PDF 函式庫,適用於 C# 和 .NET,能夠實現無縫的 PDF 生成功能、編輯和操作。 支持 .NET 8、7、6 和 Core,具備豐富的工具集,讓開發人員能處理從 HTML 到 PDF 轉換到加密和數位簽章等高級安全選項的所有內容。 使用 IronPDF,您可以在每個 PDF 頁面添加文字或 HTML 標題、使用網頁字體進行更好的文字自訂、提取文字、創建時尚的 PDF 文件等等!

HiQPdf,另一方面,主要專注於將 HTML 轉換為 PDF,提供對 CSS3、JavaScript、SVG 和 Canvas 元素的良好支援。 雖然 HiQPdf 提供可靠的 PDF 生成功能,但它缺乏 IronPDF 的某些高級功能和靈活性,尤其是在跨平台兼容性和詳細文件編輯方面。

關鍵功能比較:IronPDF 與 HiQPdf 中的 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應用程式。
  • PDF 版本支持:可以支持 PDF 版本 1.2-1.7

    要查看 IronPDF 功能的完整列表,請訪問 IronPDF 功能

HiQPdf 功能:

  • HTML 到 PDF 轉換:支援 HTML5、CSS3、JavaScript、SVG 和 canvas 元素。 HiQPdf 能夠以精確的保真度處理複雜的頁面佈局。
  • PDF 中的 JavaScript 執行:在轉換後的 PDF 中運行 JavaScript,啟用互動功能。
  • 註解及書籤:新增標準 PDF 註解,如註釋和重點標記。
  • 自訂紙張尺寸支援:在建立 PDF 過程中提供自訂紙張尺寸的選項。
  • 基本密碼保護:使用基本密碼選項保護PDF,以限制訪問和修改。
  • 頁面分隔 CSS 屬性:使用 CSS 屬性 'page-break-before:always' 控制生成的 PDF 文件中的頁面分隔。
  • 合併與拆分 PDF:將多個 PDF 合併成單一文件,或將大型 PDF 拆分為較小的文件以便於管理。

    IronPDF 擁有更廣泛的功能集,提供更先進的 PDF 編輯、安全性和跨平台兼容性,使其在與 HiQPdf 的比較中佔據優勢。

跨平台相容性

IronPDF 與 HiQPdf 之間的主要區別之一是跨平台兼容性。 IronPDF 提供對 Windows、Linux 和 macOS 的完美支援,使其成為在多樣化環境中工作的開發人員的理想選擇。 它也兼容於 Docker、Azure、AWS 和主要的 .NET 版本,包括 .NET 8、7、6 和 .NET Core。

HiQPdf 雖然功能正常,但在平台支持方面較為有限,主要集中在 Windows 環境上。

IronPDF與HiQPdf之間的頂級亮點功能比較及代碼範例

HTML 轉 PDF

IronPDF:

using IronPdf;

var renderer = new ChromePdfRenderer();
var pdf = renderer.RenderHtmlAsPdf("<h1>Hello World</h1>");
pdf.SaveAs("output.pdf");

var myAdvancedPdf = renderer.RenderHtmlAsPdf("<img src='icons/iron.png'>", @"C:\site\assets\");
myAdvancedPdf.SaveAs("html-with-assets.pdf");
using IronPdf;

var renderer = new ChromePdfRenderer();
var pdf = renderer.RenderHtmlAsPdf("<h1>Hello World</h1>");
pdf.SaveAs("output.pdf");

var myAdvancedPdf = renderer.RenderHtmlAsPdf("<img src='icons/iron.png'>", @"C:\site\assets\");
myAdvancedPdf.SaveAs("html-with-assets.pdf");
Imports IronPdf

Private renderer = New ChromePdfRenderer()
Private pdf = renderer.RenderHtmlAsPdf("<h1>Hello World</h1>")
pdf.SaveAs("output.pdf")

Dim myAdvancedPdf = renderer.RenderHtmlAsPdf("<img src='icons/iron.png'>", "C:\site\assets\")
myAdvancedPdf.SaveAs("html-with-assets.pdf")
$vbLabelText   $csharpLabel

HiQPdf:

// create the HTML to PDF converter
HtmlToPdf htmlToPdfConverter = new HtmlToPdf();

// convert HTML Code to a PDF file
htmlToPdfConverter.ConvertHtmlToFile("<b>Hello World</b>", null, "result.pdf");
// create the HTML to PDF converter
HtmlToPdf htmlToPdfConverter = new HtmlToPdf();

// convert HTML Code to a PDF file
htmlToPdfConverter.ConvertHtmlToFile("<b>Hello World</b>", null, "result.pdf");
' create the HTML to PDF converter
Dim htmlToPdfConverter As New HtmlToPdf()

' convert HTML Code to a PDF file
htmlToPdfConverter.ConvertHtmlToFile("<b>Hello World</b>", Nothing, "result.pdf")
$vbLabelText   $csharpLabel

對於HTML 轉換為 PDF,IronPDF 提供了一種簡單的方法,通過使用 ChromePdfRenderer 將 HTML 內容渲染為 PDF,不論您是使用 HTML 文檔、字符串還是 URL。 IronPDF 也支持進階情境,例如透過指定資產的檔案路徑並儲存結果來渲染包含本地資產(如圖片)的 HTML。 另一方面,HiQPdf 使用 HtmlToPdf 類,其中 HTML 內容通過更簡易的設置直接轉換為 PDF 檔案。這兩個庫都能有效地處理 HTML 到 PDF 的轉換,但 IronPDF 在資產處理方面提供了更多的靈活性。

加密 PDF 文件

IronPDF 範例:

using IronPdf;
using System;

var pdf = PdfDocument.FromFile("encrypted.pdf", "password");

pdf.MetaData.Author = "Satoshi Nakamoto";
pdf.MetaData.Keywords = "SEO, Friendly";
pdf.MetaData.ModifiedDate = DateTime.Now;

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;

pdf.Password = "my-password";
pdf.SaveAs("secured.pdf");
using IronPdf;
using System;

var pdf = PdfDocument.FromFile("encrypted.pdf", "password");

pdf.MetaData.Author = "Satoshi Nakamoto";
pdf.MetaData.Keywords = "SEO, Friendly";
pdf.MetaData.ModifiedDate = DateTime.Now;

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;

pdf.Password = "my-password";
pdf.SaveAs("secured.pdf");
Imports IronPdf
Imports System

Private pdf = PdfDocument.FromFile("encrypted.pdf", "password")

pdf.MetaData.Author = "Satoshi Nakamoto"
pdf.MetaData.Keywords = "SEO, Friendly"
pdf.MetaData.ModifiedDate = DateTime.Now

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

pdf.Password = "my-password"
pdf.SaveAs("secured.pdf")
$vbLabelText   $csharpLabel

HiQPdf:

// create the HTML to PDF converter
    HtmlToPdf htmlToPdfConverter = new HtmlToPdf();

    // set encryption mode
    htmlToPdfConverter.Document.Security.EncryptionMode = GetSelectedEncryptionMode();
    // set encryption level
    htmlToPdfConverter.Document.Security.EncryptionLevel = GetSelectedEncryptionLevel();

    // set open password
    htmlToPdfConverter.Document.Security.OpenPassword = textBoxOpenPassword.Text;
    // set permissions password
    htmlToPdfConverter.Document.Security.PermissionsPassword = textBoxPermissionsPassword.Text;

    // set PDF document permissions
    htmlToPdfConverter.Document.Security.AllowPrinting = checkBoxAllowPrint.Checked;
    htmlToPdfConverter.Document.Security.AllowCopyContent = checkBoxAllowCopy.Checked;
    htmlToPdfConverter.Document.Security.AllowEditContent = checkBoxAllowEdit.Checked;
    htmlToPdfConverter.Document.Security.AllowEditAnnotations = checkBoxAllowEditAnnotations.Checked;
    htmlToPdfConverter.Document.Security.AllowFormFilling = checkBoxAllowFillForms.Checked;

    // set a default permissions password if an open password was set without settings a permissions password
    // or if any of the permissions does not have the default value
    if (htmlToPdfConverter.Document.Security.PermissionsPassword == String.Empty &&
        (htmlToPdfConverter.Document.Security.OpenPassword != String.Empty 
 !IsDefaultPermission(htmlToPdfConverter.Document.Security)))
    {
        htmlToPdfConverter.Document.Security.PermissionsPassword = "admin";
    }
// create the HTML to PDF converter
    HtmlToPdf htmlToPdfConverter = new HtmlToPdf();

    // set encryption mode
    htmlToPdfConverter.Document.Security.EncryptionMode = GetSelectedEncryptionMode();
    // set encryption level
    htmlToPdfConverter.Document.Security.EncryptionLevel = GetSelectedEncryptionLevel();

    // set open password
    htmlToPdfConverter.Document.Security.OpenPassword = textBoxOpenPassword.Text;
    // set permissions password
    htmlToPdfConverter.Document.Security.PermissionsPassword = textBoxPermissionsPassword.Text;

    // set PDF document permissions
    htmlToPdfConverter.Document.Security.AllowPrinting = checkBoxAllowPrint.Checked;
    htmlToPdfConverter.Document.Security.AllowCopyContent = checkBoxAllowCopy.Checked;
    htmlToPdfConverter.Document.Security.AllowEditContent = checkBoxAllowEdit.Checked;
    htmlToPdfConverter.Document.Security.AllowEditAnnotations = checkBoxAllowEditAnnotations.Checked;
    htmlToPdfConverter.Document.Security.AllowFormFilling = checkBoxAllowFillForms.Checked;

    // set a default permissions password if an open password was set without settings a permissions password
    // or if any of the permissions does not have the default value
    if (htmlToPdfConverter.Document.Security.PermissionsPassword == String.Empty &&
        (htmlToPdfConverter.Document.Security.OpenPassword != String.Empty 
 !IsDefaultPermission(htmlToPdfConverter.Document.Security)))
    {
        htmlToPdfConverter.Document.Security.PermissionsPassword = "admin";
    }
' create the HTML to PDF converter
	Dim htmlToPdfConverter As New HtmlToPdf()

	' set encryption mode
	htmlToPdfConverter.Document.Security.EncryptionMode = GetSelectedEncryptionMode()
	' set encryption level
	htmlToPdfConverter.Document.Security.EncryptionLevel = GetSelectedEncryptionLevel()

	' set open password
	htmlToPdfConverter.Document.Security.OpenPassword = textBoxOpenPassword.Text
	' set permissions password
	htmlToPdfConverter.Document.Security.PermissionsPassword = textBoxPermissionsPassword.Text

	' set PDF document permissions
	htmlToPdfConverter.Document.Security.AllowPrinting = checkBoxAllowPrint.Checked
	htmlToPdfConverter.Document.Security.AllowCopyContent = checkBoxAllowCopy.Checked
	htmlToPdfConverter.Document.Security.AllowEditContent = checkBoxAllowEdit.Checked
	htmlToPdfConverter.Document.Security.AllowEditAnnotations = checkBoxAllowEditAnnotations.Checked
	htmlToPdfConverter.Document.Security.AllowFormFilling = checkBoxAllowFillForms.Checked

	' set a default permissions password if an open password was set without settings a permissions password
	' or if any of the permissions does not have the default value
	If htmlToPdfConverter.Document.Security.PermissionsPassword = String.Empty AndAlso (htmlToPdfConverter.Document.Security.OpenPassword <> String.Empty (Not IsDefaultPermission(htmlToPdfConverter.Document.Security))) Then
		htmlToPdfConverter.Document.Security.PermissionsPassword = "admin"
	End If
$vbLabelText   $csharpLabel

當涉及加密 PDF 文件時,IronPDF 提供一個使用其 API 的簡單方法。 開發人員可以移除現有密碼、設置新的安全設定、限制用戶操作如註釋、複製粘貼和表單數據輸入,並將文檔設為唯讀。 IronPDF 允許修改元數據、設置密碼保護,以及對列印許可權進行精細控制。

HiQPdf 也提供 PDF 加密,但使用略有不同的過程,專注於設置加密模式、級別、開放密碼和權限密碼。 它允許精細控制文件權限,如列印、內容複製和編輯,當未明確設置時,有預設權限可用。 兩個程式庫都提供全面的安全設置,但IronPDF提供了額外的功能,如元數據自定義和更容易處理文檔唯讀模式。

編輯 PDF 文件內容

IronPDF 範例:

using IronPdf;

PdfDocument pdf = PdfDocument.FromFile("novel.pdf");
pdf.RedactTextOnAllPages("are");
pdf.SaveAs("redacted.pdf");
using IronPdf;

PdfDocument pdf = PdfDocument.FromFile("novel.pdf");
pdf.RedactTextOnAllPages("are");
pdf.SaveAs("redacted.pdf");
Imports IronPdf

Private pdf As PdfDocument = PdfDocument.FromFile("novel.pdf")
pdf.RedactTextOnAllPages("are")
pdf.SaveAs("redacted.pdf")
$vbLabelText   $csharpLabel

HiQPdf 在其列出的功能中沒有提供明確的編輯功能。 主要專注於 PDF 的生成、轉換和操作,例如從 HTML 創建 PDF。

IronPDF 提供了從您的 PDF 文件頁面編輯內容的一種簡單方法。 例如,開發人員可以使用幾行代碼輕鬆地在整個文檔中修訂特定文本,如上面的代碼片段所示。 相比之下,HiQPdf 在其功能集中缺乏明確的遮罩功能,主要專注於 PDF 的生成、轉換和操作,比如從 HTML 創建 PDF。

數位簽署 PDF 文件

IronPDF 範例:

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

ChromePdfRenderer renderer = new ChromePdfRenderer();
PdfDocument pdf = renderer.RenderHtmlAsPdf("<h1>foo</h1>");
X509Certificate2 cert = new X509Certificate2("IronSoftware.pfx", "123456", X509KeyStorageFlags.Exportable);

var sig = new PdfSignature(cert);
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>");
X509Certificate2 cert = new X509Certificate2("IronSoftware.pfx", "123456", X509KeyStorageFlags.Exportable);

var sig = new PdfSignature(cert);
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>")
Private cert As New X509Certificate2("IronSoftware.pfx", "123456", X509KeyStorageFlags.Exportable)

Private sig = New PdfSignature(cert)
pdf.Sign(sig)
pdf.SaveAs("signed.pdf")
$vbLabelText   $csharpLabel

HiQPdf:

// create a PDF document
    PdfDocument document = new PdfDocument();

    // create a page in document
    PdfPage page1 = document.AddPage();

    // create the true type fonts that can be used in document text
    Font sysFont = new Font("Times New Roman", 10, System.Drawing.GraphicsUnit.Point);
    PdfFont pdfFont = document.CreateFont(sysFont);
    PdfFont pdfFontEmbed = document.CreateFont(sysFont, true);

    float crtYPos = 20;
    float crtXPos = 5;

    // add a title to PDF document
    PdfText titleTextTransImage = new PdfText(crtXPos, crtYPos,
            "Click the image below to open the digital signature", pdfFontEmbed);
    titleTextTransImage.ForeColor = Color.Navy;
    PdfLayoutInfo textLayoutInfo = page1.Layout(titleTextTransImage);

    crtYPos += textLayoutInfo.LastPageRectangle.Height + 10;

    // layout a PNG image with alpha transparency
    PdfImage transparentPdfImage = new PdfImage(crtXPos, crtYPos, Server.MapPath("~") + @"\DemoFiles\Images\HiQPdfLogo_small.png");
    PdfLayoutInfo imageLayoutInfo = page1.Layout(transparentPdfImage);

    // apply a digital sgnature over the image
    PdfCertificatesCollection pdfCertificates = PdfCertificatesCollection.FromFile(Server.MapPath("~") + @"\DemoFiles\Pfx\hiqpdf.pfx", "hiqpdf");
    PdfDigitalSignature digitalSignature = new PdfDigitalSignature(pdfCertificates[0]);
    digitalSignature.SigningReason = "My signing reason";
    digitalSignature.SigningLocation = "My signing location";
    digitalSignature.SignerContactInfo = "My contact info";
    document.AddDigitalSignature(digitalSignature, imageLayoutInfo.LastPdfPage, imageLayoutInfo.LastPageRectangle);

    try
    {
        // write the PDF document to a memory buffer
        byte[] pdfBuffer = document.WriteToMemory();

        // inform the browser about the binary data format
        HttpContext.Current.Response.AddHeader("Content-Type", "application/pdf");

        // let the browser know how to open the PDF document and the file name
        HttpContext.Current.Response.AddHeader("Content-Disposition", String.Format("attachment; filename=DigitalSignatures.pdf; size={0}",
                    pdfBuffer.Length.ToString()));

        // write the PDF buffer to HTTP response
        HttpContext.Current.Response.BinaryWrite(pdfBuffer);

        // call End() method of HTTP response to stop ASP.NET page processing
        HttpContext.Current.Response.End();
    }
    finally
    {
        document.Close();
    }
// create a PDF document
    PdfDocument document = new PdfDocument();

    // create a page in document
    PdfPage page1 = document.AddPage();

    // create the true type fonts that can be used in document text
    Font sysFont = new Font("Times New Roman", 10, System.Drawing.GraphicsUnit.Point);
    PdfFont pdfFont = document.CreateFont(sysFont);
    PdfFont pdfFontEmbed = document.CreateFont(sysFont, true);

    float crtYPos = 20;
    float crtXPos = 5;

    // add a title to PDF document
    PdfText titleTextTransImage = new PdfText(crtXPos, crtYPos,
            "Click the image below to open the digital signature", pdfFontEmbed);
    titleTextTransImage.ForeColor = Color.Navy;
    PdfLayoutInfo textLayoutInfo = page1.Layout(titleTextTransImage);

    crtYPos += textLayoutInfo.LastPageRectangle.Height + 10;

    // layout a PNG image with alpha transparency
    PdfImage transparentPdfImage = new PdfImage(crtXPos, crtYPos, Server.MapPath("~") + @"\DemoFiles\Images\HiQPdfLogo_small.png");
    PdfLayoutInfo imageLayoutInfo = page1.Layout(transparentPdfImage);

    // apply a digital sgnature over the image
    PdfCertificatesCollection pdfCertificates = PdfCertificatesCollection.FromFile(Server.MapPath("~") + @"\DemoFiles\Pfx\hiqpdf.pfx", "hiqpdf");
    PdfDigitalSignature digitalSignature = new PdfDigitalSignature(pdfCertificates[0]);
    digitalSignature.SigningReason = "My signing reason";
    digitalSignature.SigningLocation = "My signing location";
    digitalSignature.SignerContactInfo = "My contact info";
    document.AddDigitalSignature(digitalSignature, imageLayoutInfo.LastPdfPage, imageLayoutInfo.LastPageRectangle);

    try
    {
        // write the PDF document to a memory buffer
        byte[] pdfBuffer = document.WriteToMemory();

        // inform the browser about the binary data format
        HttpContext.Current.Response.AddHeader("Content-Type", "application/pdf");

        // let the browser know how to open the PDF document and the file name
        HttpContext.Current.Response.AddHeader("Content-Disposition", String.Format("attachment; filename=DigitalSignatures.pdf; size={0}",
                    pdfBuffer.Length.ToString()));

        // write the PDF buffer to HTTP response
        HttpContext.Current.Response.BinaryWrite(pdfBuffer);

        // call End() method of HTTP response to stop ASP.NET page processing
        HttpContext.Current.Response.End();
    }
    finally
    {
        document.Close();
    }
' create a PDF document
	Dim document As New PdfDocument()

	' create a page in document
	Dim page1 As PdfPage = document.AddPage()

	' create the true type fonts that can be used in document text
	Dim sysFont As New Font("Times New Roman", 10, System.Drawing.GraphicsUnit.Point)
	Dim pdfFont As PdfFont = document.CreateFont(sysFont)
	Dim pdfFontEmbed As PdfFont = document.CreateFont(sysFont, True)

	Dim crtYPos As Single = 20
	Dim crtXPos As Single = 5

	' add a title to PDF document
	Dim titleTextTransImage As New PdfText(crtXPos, crtYPos, "Click the image below to open the digital signature", pdfFontEmbed)
	titleTextTransImage.ForeColor = Color.Navy
	Dim textLayoutInfo As PdfLayoutInfo = page1.Layout(titleTextTransImage)

	crtYPos += textLayoutInfo.LastPageRectangle.Height + 10

	' layout a PNG image with alpha transparency
	Dim transparentPdfImage As New PdfImage(crtXPos, crtYPos, Server.MapPath("~") & "\DemoFiles\Images\HiQPdfLogo_small.png")
	Dim imageLayoutInfo As PdfLayoutInfo = page1.Layout(transparentPdfImage)

	' apply a digital sgnature over the image
	Dim pdfCertificates As PdfCertificatesCollection = PdfCertificatesCollection.FromFile(Server.MapPath("~") & "\DemoFiles\Pfx\hiqpdf.pfx", "hiqpdf")
	Dim digitalSignature As New PdfDigitalSignature(pdfCertificates(0))
	digitalSignature.SigningReason = "My signing reason"
	digitalSignature.SigningLocation = "My signing location"
	digitalSignature.SignerContactInfo = "My contact info"
	document.AddDigitalSignature(digitalSignature, imageLayoutInfo.LastPdfPage, imageLayoutInfo.LastPageRectangle)

	Try
		' write the PDF document to a memory buffer
		Dim pdfBuffer() As Byte = document.WriteToMemory()

		' inform the browser about the binary data format
		HttpContext.Current.Response.AddHeader("Content-Type", "application/pdf")

		' let the browser know how to open the PDF document and the file name
		HttpContext.Current.Response.AddHeader("Content-Disposition", String.Format("attachment; filename=DigitalSignatures.pdf; size={0}", pdfBuffer.Length.ToString()))

		' write the PDF buffer to HTTP response
		HttpContext.Current.Response.BinaryWrite(pdfBuffer)

		' call End() method of HTTP response to stop ASP.NET page processing
		HttpContext.Current.Response.End()
	Finally
		document.Close()
	End Try
$vbLabelText   $csharpLabel

數位簽署PDF 檔案中,IronPDF 透過提供一個簡單的方法,允許開發者從 HTML 內容創建 PDF 文件,並使用數位憑證簽名,然後以最少的代碼保存。 另一方面,HiQPdf 需要更複雜的設置,程式化地建立 PDF 文件,通過添加頁面和嵌入字體來完成。 包含標題和圖片,然後使用指定的證書應用數位簽章,以及詳細的中繼資料,例如簽署原因和地點。

應用自定義水印

IronPDF 範例:

using IronPdf;

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;

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

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

HiQPdf:

沒有內建的專用浮水印工具。

應用自定水印時,IronPDF 提供一個簡單明瞭的解決方案,內建支援向 PDF 添加水印。 在範例中,將 URL 渲染為 PDF,並在頁面中央應用具有 HTML 樣式的可自訂浮水印。 這允許輕鬆修改浮水印的內容、樣式和位置。 相比之下,HiQPdf 缺乏內建的專用浮水印工具,對於需要在庫中直接使用此功能的開發人員來說,使用起來較不方便。

將圖像和文字添加到 PDF 上

IronPDF 範例(文字印章):

using IronPdf;
using IronPdf.Editing;

ChromePdfRenderer renderer = new ChromePdfRenderer();
PdfDocument pdf = renderer.RenderHtmlAsPdf("<h1>Example HTML Document!</h1>");

TextStamper textStamper = new TextStamper()
{
    Text = "Text Stamper!",
    FontFamily = "Bungee Spice",
    UseGoogleFont = true,
    FontSize = 30,
    IsBold = true,
    IsItalic = true,
    VerticalAlignment = VerticalAlignment.Top
};

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

TextStamper textStamper = new TextStamper()
{
    Text = "Text Stamper!",
    FontFamily = "Bungee Spice",
    UseGoogleFont = true,
    FontSize = 30,
    IsBold = true,
    IsItalic = true,
    VerticalAlignment = VerticalAlignment.Top
};

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

Private textStamper As New TextStamper() With {
	.Text = "Text Stamper!",
	.FontFamily = "Bungee Spice",
	.UseGoogleFont = True,
	.FontSize = 30,
	.IsBold = True,
	.IsItalic = True,
	.VerticalAlignment = VerticalAlignment.Top
}

pdf.ApplyStamp(textStamper)
pdf.SaveAs("stampText.pdf")
$vbLabelText   $csharpLabel

IronPDF 範例(圖片印章):

using IronPdf;
using IronPdf.Editing;

ChromePdfRenderer renderer = new ChromePdfRenderer();
PdfDocument pdf = renderer.RenderHtmlAsPdf("<h1>Example HTML Document!</h1>");

ImageStamper imageStamper = new ImageStamper(new Uri("/img/svgs/iron-pdf-logo.svg"))
{
    VerticalAlignment = VerticalAlignment.Top
};

pdf.ApplyStamp(imageStamper, 0);
pdf.SaveAs("stampImage.pdf");
using IronPdf;
using IronPdf.Editing;

ChromePdfRenderer renderer = new ChromePdfRenderer();
PdfDocument pdf = renderer.RenderHtmlAsPdf("<h1>Example HTML Document!</h1>");

ImageStamper imageStamper = new ImageStamper(new Uri("/img/svgs/iron-pdf-logo.svg"))
{
    VerticalAlignment = VerticalAlignment.Top
};

pdf.ApplyStamp(imageStamper, 0);
pdf.SaveAs("stampImage.pdf");
Imports IronPdf
Imports IronPdf.Editing

Private renderer As New ChromePdfRenderer()
Private pdf As PdfDocument = renderer.RenderHtmlAsPdf("<h1>Example HTML Document!</h1>")

Private imageStamper As New ImageStamper(New Uri("/img/svgs/iron-pdf-logo.svg")) With {.VerticalAlignment = VerticalAlignment.Top}

pdf.ApplyStamp(imageStamper, 0)
pdf.SaveAs("stampImage.pdf")
$vbLabelText   $csharpLabel

HiQPdf:

HiQPdf 沒有專用的蓋章工具,無法直接將文字或圖像作為印章添加到 PDF 文件中。 然而,它允許您將文字、圖像和圖形物件添加到 PDF 中,這些可以達到類似的目的。 這可以透過使用庫中提供的功能,在 PDF 中創建文字對象和圖像對象來實現。

IronPDF 提供專門的類別,可以將文字和圖片蓋章直接放到任何現有的 PDF 文件或新創建的文件上,使開發人員的操作流程變得簡單。 相比之下,HiQPdf 缺少專用的蓋章工具; 相反,它允許用戶在 PDF 中新增文字和圖像物件,需要採取更手動的方法來實現類似的結果。

DOCX 轉換為 PDF

IronPDF 範例:

using IronPdf;

DocxToPdfRenderer renderer = new DocxToPdfRenderer();
PdfDocument pdf = renderer.RenderDocxAsPdf("Modern-chronological-resume.docx");
pdf.SaveAs("pdfFromDocx.pdf");
using IronPdf;

DocxToPdfRenderer renderer = new DocxToPdfRenderer();
PdfDocument pdf = renderer.RenderDocxAsPdf("Modern-chronological-resume.docx");
pdf.SaveAs("pdfFromDocx.pdf");
Imports IronPdf

Private renderer As New DocxToPdfRenderer()
Private pdf As PdfDocument = renderer.RenderDocxAsPdf("Modern-chronological-resume.docx")
pdf.SaveAs("pdfFromDocx.pdf")
$vbLabelText   $csharpLabel

HiQPdf:

由於HiQPdf主要是一個將HTML轉換為PDF的庫,它並不提供任何內建的DOCX到PDF的工具。

IronPDF 透過其 DocxToPdfRenderer 類別提供對 DOCX 到 PDF 轉換 的直接支援,然而 HiQPdf 缺乏將 DOCX 檔案轉換為 PDF 的內建工具,而是專注於 HTML 到 PDF 的轉換。

代碼範例比較摘要

Hiqpdf Html To Pdf Alternative 1 related to 代碼範例比較摘要

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

文件和支援:IronPDF vs. HiQPdf

IronPDF 文件和支援:

IronPDF 提供開發者友好的文檔體驗。 其強大的文件資料確保開發人員無論是初學者還是高級用戶,都能將 IronPDF 有效地整合到他們的項目中。 IronPDF 文件的一些關鍵方面包括:

  • 逐步指南:每個功能的全面教程,確保開發人員從開始到完成都有明確的路徑。
  • 24/5 技術支援:工程師在週一到週五的工作時間內隨時提供協助,幫助解答任何問題或疑問。
  • 即時聊天:提供即時支援以解決任何授權或技術問題。
  • 電子郵件支援:用戶可以提出詳細的查詢,且回應迅速且有幫助。
  • API 參考資料:提供每個方法和屬性的詳細 API 文件及範例。
  • 代碼範例:現成的代碼片段,用於常見的任務,如HTML轉PDF、加密、浮水印等。
  • 定期更新:文檔經常更新,以反映庫的變更和新功能。

    欲了解更多資訊,請查閱IronPDF的詳細文件,並造訪Iron Software的YouTube頻道

HiQPdf 文件和支持:

HiQPdf 提供基本的文件,支援大多數的核心功能。 儘管它提供了HTML轉PDF轉換和基本PDF操作的功能,但其文檔缺乏IronPDF所提供的深度和全面性。 HiQPdf 文件的主要方面包括:

  • 基本 API 參考:列出 HTML 轉 PDF 和基本 PDF 操作的方法。
  • 程式碼範例:限量的 HTML 轉 PDF 與頁面設置範例代碼。
  • 最小跨平台指導:主要關注 Windows 環境,對跨平台部署的指導較少。
  • Email Support:主要用於許可證和基礎技術問題的查詢。
  • 有限的在線支援:即時援助的選擇較少。

    如需有關 HiQPdf 的更多技術細節,用戶需搜尋其他資源或外部論壇。

定價和授權:IronPDF 與 HiQPdf 之比較

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 產品的使用權,包括 IronPDF IronOCR IronWord IronXL IronBarcode IronQR IronZIP IronPrint IronWebScraper

    Hiqpdf Html To Pdf Alternative 2 related to IronPDF 價格和授權

HiQPdf 價格和授權:

HiQPdf 也提供各種授權選項,但其定價往往略顯僵硬:

  • 初創公司許可證:單一開發者及單一應用程式的價格為 $245
  • 開發者授權:$495 可供一位開發者使用於任意數量的應用程式。
  • Team License: $795 可供至多五名開發者使用於不限數量的應用程式開發。
  • 企業授權:$1,095,無限制的開發人員數量可搭配任意數量的應用程式。

    雖然 HiQPdf 的價格具有競爭性,但其所提供的價值不如 IronPDF 通過 Iron Suite 提供的套裝產品,也沒有同等價格下所包含的廣泛高級功能。

結論

IronPDF 和 HiQPdf 都是 .NET 開發者在其應用程式中整合 PDF 功能的可靠選擇。 然而,IronPDF 以其豐富的功能集、易用性和強大的文檔支持而脫穎而出。 IronPDF具有跨平台相容性、豐富的程式碼範例和優秀的支援,是需要在不同環境中使用全面 PDF 功能的開發人員的絕佳解決方案。

如果您正在尋找一個提供卓越性能、靈活性和支援的完整解決方案,IronPDF 是一個強烈推薦的選擇。此外,IronPDF 能夠輕鬆處理加密、修訂和數位簽名等高級功能,這使得它與 HiQPdf 不同。

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