在实际环境中测试
在生产中测试无水印。
随时随地为您服务。
对于使用.NET进行开发的程序员来说,找到合适的PDF解决方案对于构建功能丰富的应用程序至关重要。在当今现代时代,随着提供PDF转换技术的产品数量不断增加,很难找到满足需求的合适工具。 在本次比较中,我们将评估IronPDF和 HiQPdf,是两个在 .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略显逊色。
PDF版本支持: 可以支持PDF版本1.2-1.7
要获取 IronPDF 功能的完整列表,请访问IronPDF 功能.
合并和分割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:
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")
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")
对于HTML 转换为 PDF,IronPDF通过使用ChromePdfRenderer将HTML内容渲染为PDF提供了一种简单的方法,无论您是处理HTML文档、字符串还是URL。 IronPDF 还支持高级场景,例如通过指定资产的文件路径并保存结果,来渲染带有本地资产(如图像)的 HTML。 HiQPdf 则使用 HtmlToPdf 类,其中 HTML 内容直接转换为 PDF 文件,设置较为基础。这两个库都能有效地处理 HTML 到 PDF 的转换,但 IronPDF 在资产处理方面提供了额外的灵活性。
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")
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
当涉及到加密PDF文档IronPDF 通过其 API 提供了一种简单的方法。 开发人员可以删除现有密码,设置新的安全设置,限制用户操作,如注释、复制粘贴和表单数据输入,并使文档仅限于只读。 IronPDF允许修改元数据、密码保护和对打印权限的精细控制。
HiQPdf 也提供 PDF 加密功能,但过程稍有不同,主要关注设置加密模式、级别、打开密码和权限密码。 它允许对文档权限进行细粒度控制,例如打印、内容复制和编辑,当未显式设置时可使用默认权限。 两个库都提供了全面的安全设置,但IronPDF提供了额外的功能,如元数据定制和更轻松的处理文档只读模式。
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")
HiQPdf 在其列出的功能中未提供明确的编辑功能。 它主要专注于PDF的生成、转换和操作,例如从HTML创建PDF。
IronPDF 提供了一种简单的方法来编辑内容从您的 PDF 文档页面。 例如,开发人员可以通过几行代码轻松地在整个文档中编辑特定文本,如上面的代码片段所示。 相比之下,HiQPdf 缺乏明确的编辑功能,其功能集主要专注于 PDF 生成、转换和操作,例如从 HTML 创建 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")
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
在数字签名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")
HiQPdf:
没有内置的专用水印工具。
当应用自定义水印IronPDF 提供了一种简单的解决方案,内置支持将水印添加到 PDF。 在该示例中,将 URL 渲染为 PDF,并在页面中央应用带有 HTML 样式的可自定义水印。 这允许轻松修改水印的内容、样式和位置。 相比之下,HiQPdf 缺乏内置的专用水印工具,使得需要在库中直接使用此功能的开发人员不太方便。
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")
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("https://ironpdf.com/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("https://ironpdf.com/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("https://ironpdf.com/img/svgs/iron-pdf-logo.svg")) With {.VerticalAlignment = VerticalAlignment.Top}
pdf.ApplyStamp(imageStamper, 0)
pdf.SaveAs("stampImage.pdf")
HiQPdf:
HiQPdf没有专门的工具可以将文本或图像直接作为印章添加到PDF文档上。 但是,它允许您向 PDF 添加文本、图像和图形对象,这可以达到类似的目的。 这可以通过使用库中可用的功能在PDF中创建文本对象和图像对象来实现。
IronPDF 提供专用类用于在文本和图像上盖章直接在任何现有的PDF文档或新创建的文档上进行操作,使开发人员的过程变得简单。 相比之下,HiQPdf 缺乏专用的图章工具; 相反,它允许用户在 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")
HiQPdf:
由于HiQPdf主要是一个HTML到PDF转换库,它没有提供任何内置的DOCX到PDF工具。
IronPDF 提供直接支持DOCX 转换为 PDF通过其DocxToPdfRenderer类,而HiQPdf缺乏将DOCX文件转换为PDF的内置工具,而是专注于HTML到PDF的转换。
要了解 IronPDF 提供的丰富功能集并查看其实际应用,请查看 IronPDF。如何操作指南深入探讨每个功能,探索其工作原理,并为您提供成为PDF专家所需的技能。
IronPDF 提供对开发人员友好的文档体验。 其强大的文档能够确保开发人员,无论是初学者还是高级用户,能够有效地将IronPDF集成到他们的项目中。 IronPDF 文档的一些关键方面包括:
定期更新:文档会经常更新,以反映库的变化和新功能。
如需更多信息,请查看IronPDF的广泛内容。文档,并访问Iron Software YouTube 频道.
HiQPdf提供基本的文档,支持其大部分核心功能。 虽然它提供了HTML到PDF的转换功能和基本的PDF操作,但文档的深度和全面性不如IronPDF。 HiQPdf 文档的关键方面包括:
有限的实时支持:实时协助选项较少。
有关HiQPdf的更多技术细节,用户需要通过额外的资源或外部论坛进行搜索。
IronPDF拥有不同级别和购买许可证的附加功能。 开发者还可以购买Iron Suite让您以两个产品的价格访问Iron Software的所有产品。 如果您还没有准备好购买许可证,IronPDF提供一个免费试用这样您就可以在购买许可证之前探索其提供的所有功能。
IronSuite:支付 $1,498,即可获取所有 Iron Software 产品,包括IronPDF,IronOCR,IronWord,IronXL,IronBarcode,IronQR,IronZIP,IronPrint, 和IronWebScraper.
HiQPdf也提供多种许可选项,但其定价往往略显僵化:
企业许可证:$1,095,适用于不限数量的开发人员和任意数量的应用程序。
虽然HiQPdf的定价具有竞争力,但它提供的价值不如IronPDF通过IronSuite捆绑的价值,价格中包含的高级功能也不如IronPDF广泛。
IronPDF 和 HiQPdf 都是 .NET 开发人员在其应用程序中集成 PDF 功能的可靠选择。 但是IronPDF以其广泛的功能集、易用性和强大的文档而出色。 IronPDF 具备跨平台兼容性、丰富的代码示例和出色的支持,是开发人员在不同环境中需要全面 PDF 功能的绝佳解决方案。
如果您正在寻找可以提供卓越性能、灵活性和支持的完整解决方案,IronPDF是一个非常推荐的选择。此外,IronPDF 处理加密、编辑和数字签名等高级功能的能力轻松地使其区别于 HiQPdf。