透かしなしで本番環境でテストしてください。
必要な場所で動作します。
30日間、完全に機能する製品をご利用いただけます。
数分で稼働させることができます。
製品トライアル期間中にサポートエンジニアリングチームへの完全アクセス
IronPDF と EvoPdf は、PDF ドキュメントの作成、編集、管理に使用される 2 つの有名な .NET ライブラリです。 それぞれは、.NETプラットフォームで作業する開発者に合わせたユニークな強みと特徴を持っています。 本記事では、これら2つのライブラリの機能、互換性、ライセンス、サポートなどを中心に詳細な比較を行います。
この記事の終わりまでには、どのライブラリがあなたのPDFのニーズに最適かを特定でき、さらに他のPDFライブラリのオプションを調査したい場合は、独自に比較検討できるようになることを願っています。
IronPDF は、開発者がプログラムでPDFドキュメントを作成、編集、操作できる.NET PDFライブラリです。 その使いやすさ、.NETバージョンとの広範な互換性、およびHTML、ASPX、画像ファイルを元のコンテンツの高い忠実度を保ちつつPDFに変換する能力で知られています。 IronPDFの充実したドキュメント、強力なカスタマーサポート、豊富な機能セットは、.NETアプリケーションにPDF機能を統合したい開発者にとって好まれる選択肢となっています。
EvoPdfは、HTMLをPDFに変換したり、その他のPDF操作を行うために設計されたもう一つの.NETライブラリです。 それは、HTMLタグ、CSS、JavaScript、およびその他の最新のウェブ技術に対する高度なサポートを提供し、ウェブコンテンツから高品質のPDF文書を生成することを可能にします。 EvoPdfは、レンダリング機能とウェブ標準の広範なサポートで高く評価されており、ウェブからPDFへの変換に注力する開発者にとって貴重なツールです。
IronPDFは、さまざまな環境で使用できる多用途なツールとして、広範なクロスプラットフォーム互換性を提供します。
.NET バージョン:
C#、VB.NET、F#で完全に記述されており、サポートしています。
.NET Core(8、7、6、5、および3.1+)。
OSとプロセッサ: Windows、Mac、Linux、x64、x86、ARMを含む様々なOSとプロセッサをサポート
IronPDFの互換性に関する詳細については、IronPDF Compatibilityをご覧ください。
.NET バージョン:
.NET Core (8, 7, 6, and 5)
IronPDFとEvoPdfの両方は強力なPDF操作機能を提供しますが、開発者が考慮すべき明確な違いがあります。
統合: ASP.NETやMVCアプリケーションとシームレスに統合されます。
IronPDFの機能の包括的なリストについては、IronPDF Featuresをご覧ください。
以下は、IronPDFとEvoPdfの主要な機能の詳細な比較と、それらの使用方法を示す具体的なコード例です。
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")
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")
HTMLからPDFへの変換は一般的なPDF関連のタスクであり、上記のコードサンプルでわかるように、IronPDFとEvoPdfの両方がこの作業を簡単にこなすことができます。 IronPDFは、最新のウェブサポートを活用してHTMLコンテンツをピクセルパーフェクトにレンダリングします。そのため、元のレンダー品質を維持しながら、わずか数行のコードで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")
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
IronPDFは、プロセスとさまざまなセキュリティ設定を完全にコントロールしながら、暗号化設定を管理するための包括的なAPIを提供します。 EvoPdfの暗号化ツールは、プロセスに対して同様のレベルの制御を提供し、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")
EvoPdf: テキスト墨消しの組み込みサポートが欠如しています。
IronPDF は、わずか数行のコードで PDF ファイルから指定されたコンテンツを墨消しできる強力な PDF 墨消しツール を提供します。 一方、EvoPdfには組み込みの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")
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
IronPDFは、PDFファイルにデジタル署名を適用するための強力なAPIを提供し、プロセスを簡潔で理解しやすくしています。 EvoPdfは署名の基本的なサポートを提供しますが、IronPDFによって提供される広範なオプションが不足しており、手動でより複雑なアプローチを取っています。
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")
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
IronPDFは、簡潔でありながら堅牢なPDFウォーターマーキングツールを提供しており、セットアップに関して多くを必要とせずにPDFファイルにカスタムウォーターマークを簡単に適用できます。一方、EvoPdfはウォーターマーキングツールのセットアップにかなりの努力が必要で、より洗練されていないオプションです。
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")
画像スタンパー:
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")
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")
EvoPdf: DOCXファイルをPDF形式に変換するには、Evo Work to PDFコンバーターライブラリを使用する必要があります。
IronPDFは、直感的なAPIを提供し、DOCXからPDFへの変換を行いやすくしています。EvoPdfでは、このタスクを実行するためには、Evo Word to PDFツールがインストールされていることを確認する必要があります。
IronPDFが提供する豊富な機能セットの詳細を学び、それらを実際に体験するには、各機能を深く掘り下げて、その動作を探り、PDFのプロになるために必要なスキルを提供するIronPDFハウツーガイドをご覧ください。
IronPDFには、ライセンスを購入するためのさまざまなレベルと追加機能があります。 開発者は、Iron Suiteを購入することもでき、これはIron Softwareのすべての製品に2つの価格でアクセスできるようにします。 ライセンスを購入する準備が整っていない場合、IronPDFは無料トライアルを提供しており、ライセンスにコミットする前にすべての機能を探索することができます。
Iron Suite: 1,498ドルで、IronPDF、IronOCR、IronWord、IronXL、IronBarcode、IronQR、IronZIP、IronPrint、およびIronWebScraperを含むすべてのIron Software製品にアクセスできます。
EvoPdfのライセンシングは、デプロイメントライセンスとカンパニーライセンスの2つのモデルに基づいています。 どちらのオプションも永久ライセンスとして提供され、最初の1年間は技術サポートとソフトウェアの更新が付属します。
IronPDFは、その広範で詳細なドキュメントと開発者サポートを誇りにしています。
PDF API リファレンス: 弊社のツールが提供する機能を最大限に活用できるよう、API リファレンスを提供しています。
詳細については、IronPDFの充実したドキュメントをご覧いただき、Iron Software YouTube チャンネルを訪問してください。
IronPDF と EvoPdf は、両方とも .NET 開発者向けの高機能な PDF ライブラリです。 ただし、IronPDFの豊富な機能セット、強力なクロスプラットフォーム互換性、柔軟なライセンスオプション、優れたドキュメントとサポートにより、ほとんどの開発プロジェクトにとってより魅力的な選択肢となります。 IronPDFを使用すると、豊富で強力な機能セットを使って、PDF関連の作業を簡単に行うことができます。
EvoPdfは、特にHTMLからPDFへの変換ツールに特化したものを探していて、より高度なライブラリの多機能を求めない方にとって、堅実な代替手段です。ただし、すべてのツールキットを購入すれば、機能を追加および削除するオプションもあります。
30日間の無料トライアルを試して、利用可能な機能を確認できます。