產品比較

IronPDF與SelectPDF之比較

已更新 2024年8月28日
分享:

簡介

當您處理 PDF 文件時,選擇適合自己需求的工具是重要的第一步。您是在尋找僅僅將 HTML 內容轉換為 PDF 文件的工具嗎?還是您的 PDF 項目需要更複雜的工具,如加密和應用電子簽名?今天,我們將探討兩個 PDF 庫,IronPDF 和 SelectPdf,並研究如何使用這些庫來提升您的 PDF 工作區。

IronPDF和SelectPdf概述

IronPDF 是為 .NET 生態系統中所有 PDF 相關任務提供一站式解決方案。它支持 HTML、CSS、JavaScript 以及多種圖像格式,因此非常適合用於基於 Web 的應用程序。IronPDF 擁有多種功能,如生成 PDF、編輯 PDF 或簽名和加密,是添加到您的工具組合中的極佳工具。

SelectPdf 提供靈活的 HTML 到 PDF 轉換器,適用於可在 .NET Framework 和 .NET Core 平台上運行的 .NET 應用程序。它提供了豐富的功能來創建 PDF 文件和操作現有的 PDF 文檔,這使得它適合於各種業務和個人場景。

跨平台相容性

IronPDF:

IronPDF 支援多種平台,確保您能在偏好的環境中工作。以下是其相容性的一個概述:

  • .NET 版本:

    • (C#, VB.NET, F#)

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

    • .NET Standard (2.0+)

    .NET Framework (4.6.2+)

  • 應用環境: IronPDF 能夠在包括 Windows、Linux、Mac、Docker、Azure 和 AWS 的環境中工作
  • 集成開發環境: 支持 Microsoft Visual Studio 和 JetBrains Rider & ReSharper 等集成開發環境
  • 操作系統和處理器: 支持多種不同的操作系統和處理器,包括 Windows、Mac、Linux、x64、x86、ARM

更多信息,請訪問 IronPDF 相容性.

SelectPdf

  • .NET 版本:

    • .NET Framework 4.0+
    • .NET Core 2.1+
  • .NET Standard 2.0
  • 應用環境: SelectPdf 只能在 Windows 作業系統上運行,但也支援雲端環境,如 Azure。

主要功能比較:IronPDF vs. SelectPdf中的PDF功能

IronPDF

  • HTML 轉 PDF 轉換: IronPDF 能夠處理 HTML 轉 PDF 轉換,並完全支持現代網頁標準,您可以放心,IronPDF 將始終從您的 HTML 內容中返回像素完美的 PDF。
  • PDF 文件轉換: 需要將其他文件格式轉換為 PDF 嗎?使用 IronPDF 可轉換 DOCX 為 PDF、RTF 為 PDF、圖像為 PDF、URL 為 PDF,甚至 PDF 為 HTML,並保持所需的文檔結構。
  • 安全功能: 使用 IronPDF,您可以始終放心任何敏感的 PDF 文件是安全的,因為其安全功能。使用 IronPDF 設置 PDF 的安全設置,設置密碼,並設置 PDF 文件的權限。
  • PDF 編輯功能: 使用 IronPDF 您可以輕鬆編輯現有文檔。IronPDF 提供編輯功能,例如添加頁眉和頁腳、在 PDF 頁面上加蓋文本和圖像、合併和拆分 PDF 文檔、為 PDF 添加自定義水印以及處理 PDF 表單。

有關 IronPDF 提供的功能的詳細信息,請訪問 IronPDF 功能.

SelectPdf

  • PDF 生成: 從頭生成 PDF 文件,或從 HTML 內容(如原始 HTML 字符串、網頁等)生成 PDF。
  • 操作 PDF 文件: 添加、合併和拆分 PDF 頁面,並從現有 PDF 文件中提取頁面。
  • PDF 設置: 設置 PDF 頁面設置,如頁面方向、大小和邊距。設置 PDF 查看器偏好和 PDF 文件屬性。
  • PDF 安全: 設置您的 PDF 文件安全設置,用密碼加密您的 PDF 文件,並編輯您的 PDF 文件的權限。

IronPDF 與 SelectPdf 之間的頂級亮點功能比較及其代碼示例

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

// Advanced Example with HTML Assets
// Load external html assets: images, CSS and JavaScript.
// An optional BasePath 'c:\site\assets\' is set as the file location to load assets from
var myAdvancedPdf = renderer.RenderHtmlAsPdf("<img src='icons/iron.png'>", @"c:\site\assets\");
myAdvancedPdf.SaveAs("html-with-assets.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");

// Advanced Example with HTML Assets
// Load external html assets: images, CSS and JavaScript.
// An optional BasePath 'c:\site\assets\' is set as the file location to load assets from
var myAdvancedPdf = renderer.RenderHtmlAsPdf("<img src='icons/iron.png'>", @"c:\site\assets\");
myAdvancedPdf.SaveAs("html-with-assets.pdf");
IRON VB CONVERTER ERROR developers@ironsoftware.com
VB   C#

SelectPdf:

// instantiate an HTML to PDF converter object
HtmlToPdf converter = new HtmlToPdf();

// create a new pdf document converting an url
PdfDocument doc = converter.ConvertUrl(url);

// save pdf document
doc.Save(file);

// close pdf document
doc.Close();
// instantiate an HTML to PDF converter object
HtmlToPdf converter = new HtmlToPdf();

// create a new pdf document converting an url
PdfDocument doc = converter.ConvertUrl(url);

// save pdf document
doc.Save(file);

// close pdf document
doc.Close();
IRON VB CONVERTER ERROR developers@ironsoftware.com
VB   C#

無論您是想將多個網頁轉換為相同的 PDF 文檔,還是單個 HTML 字符串,IronPDF 都能通過使用 ChromePdfRenderer 和支持現代網頁標準來提供高保真度的 PDF 文件。使用 IronPDF,您可以轉換 HTML轉PDF 使用幾行代碼。SelectPdf 的 HTML 到 PDF 轉換工具簡潔且實施迅速,但可能無法產生同樣高質量的輸出。pdf. 轉換

如果您想了解有關 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
// The following code makes a PDF read only and will disallow copy & paste and printing
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");
<br>
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
// The following code makes a PDF read only and will disallow copy &amp; paste and printing
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");
<br>
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
' The following code makes a PDF read only and will disallow copy &amp; paste and printing
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")
'INSTANT VB TODO TASK: The following line uses invalid syntax:
'<br>
VB   C#

SelectPdf:

// set document passwords
doc.Security.OwnerPassword = "test1";
doc.Security.UserPassword = "test2";

//set document permissions
doc.Security.CanAssembleDocument = false;
doc.Security.CanCopyContent = true;
doc.Security.CanEditAnnotations = true;
doc.Security.CanEditContent = true;
doc.Security.CanFillFormFields = true;
doc.Security.CanPrint = true;
// set document passwords
doc.Security.OwnerPassword = "test1";
doc.Security.UserPassword = "test2";

//set document permissions
doc.Security.CanAssembleDocument = false;
doc.Security.CanCopyContent = true;
doc.Security.CanEditAnnotations = true;
doc.Security.CanEditContent = true;
doc.Security.CanFillFormFields = true;
doc.Security.CanPrint = true;
' set document passwords
doc.Security.OwnerPassword = "test1"
doc.Security.UserPassword = "test2"

'set document permissions
doc.Security.CanAssembleDocument = False
doc.Security.CanCopyContent = True
doc.Security.CanEditAnnotations = True
doc.Security.CanEditContent = True
doc.Security.CanFillFormFields = True
doc.Security.CanPrint = True
VB   C#

當您在尋找 加密 您的PDF文件,IronPDF和SelectPdf都提供內建的加密工具。IronPDF的加密功能相當全面,讓您能完全掌控各種安全設定,且使用起來非常簡單。SelectPdf的加密功能簡潔容易,並且可以輕鬆地整合到您的專案中。

欲了解更多關於為PDF文件添加密碼和權限的資訊,請訪問IronPDF的幫助頁面。 操作指南 指南。

編修 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#

SelectPdf:

SelectPdf 不直接支援編輯。

IronPDF 提供簡潔而強大的 PDF 功能。 編輯工具 只需幾行代碼即可進行特定內容的遮罩。相比之下,SelectPdf 缺乏任何內建的遮罩功能。

為 PDF 進行數位簽名

IronPDF:

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

ChromePdfRenderer renderer = new ChromePdfRenderer();
PdfDocument pdf = renderer.RenderHtmlAsPdf("&lt;h1&gt;foo&lt;/h1&gt;");

// 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("&lt;h1&gt;foo&lt;/h1&gt;");

// 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("&lt;h1&gt;foo&lt;/h1&gt;")

' 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#

SelectPdf:

// create a new pdf document
PdfDocument doc = new PdfDocument();

// add a new page to the document
PdfPage page = doc.AddPage();

// get image path 
// the image will be used to display the digital signature over it
string imgFile = Server.MapPath("~/files/logo.png");

// get certificate path
string certFile = Server.MapPath("~/files/selectpdf.pfx");

// define a rendering result object
PdfRenderingResult result;

// create image element from file path 
PdfImageElement img = new PdfImageElement(0, 0, imgFile);
result = page.Add(img);

// get the #PKCS12 certificate from file
PdfDigitalCertificatesCollection certificates =
    PdfDigitalCertificatesStore.GetCertificates(certFile, "selectpdf");
PdfDigitalCertificate certificate = certificates[0];

// create the digital signature object
PdfDigitalSignatureElement signature =
    new PdfDigitalSignatureElement(result.PdfPageLastRectangle, certificate);
signature.Reason = "SelectPdf";
signature.ContactInfo = "SelectPdf";
signature.Location = "SelectPdf";
page.Add(signature);

// save pdf document
doc.Save(Response, false, "Sample.pdf");

// close pdf document
doc.Close();
// create a new pdf document
PdfDocument doc = new PdfDocument();

// add a new page to the document
PdfPage page = doc.AddPage();

// get image path 
// the image will be used to display the digital signature over it
string imgFile = Server.MapPath("~/files/logo.png");

// get certificate path
string certFile = Server.MapPath("~/files/selectpdf.pfx");

// define a rendering result object
PdfRenderingResult result;

// create image element from file path 
PdfImageElement img = new PdfImageElement(0, 0, imgFile);
result = page.Add(img);

// get the #PKCS12 certificate from file
PdfDigitalCertificatesCollection certificates =
    PdfDigitalCertificatesStore.GetCertificates(certFile, "selectpdf");
PdfDigitalCertificate certificate = certificates[0];

// create the digital signature object
PdfDigitalSignatureElement signature =
    new PdfDigitalSignatureElement(result.PdfPageLastRectangle, certificate);
signature.Reason = "SelectPdf";
signature.ContactInfo = "SelectPdf";
signature.Location = "SelectPdf";
page.Add(signature);

// save pdf document
doc.Save(Response, false, "Sample.pdf");

// close pdf document
doc.Close();
' create a new pdf document
Dim doc As New PdfDocument()

' add a new page to the document
Dim page As PdfPage = doc.AddPage()

' get image path 
' the image will be used to display the digital signature over it
Dim imgFile As String = Server.MapPath("~/files/logo.png")

' get certificate path
Dim certFile As String = Server.MapPath("~/files/selectpdf.pfx")

' define a rendering result object
Dim result As PdfRenderingResult

' create image element from file path 
Dim img As New PdfImageElement(0, 0, imgFile)
result = page.Add(img)

' get the #PKCS12 certificate from file
Dim certificates As PdfDigitalCertificatesCollection = PdfDigitalCertificatesStore.GetCertificates(certFile, "selectpdf")
Dim certificate As PdfDigitalCertificate = certificates(0)

' create the digital signature object
Dim signature As New PdfDigitalSignatureElement(result.PdfPageLastRectangle, certificate)
signature.Reason = "SelectPdf"
signature.ContactInfo = "SelectPdf"
signature.Location = "SelectPdf"
page.Add(signature)

' save pdf document
doc.Save(Response, False, "Sample.pdf")

' close pdf document
doc.Close()
VB   C#

使用 IronPDF,應用 數位簽章 透過其簡單、穩定的PDF簽名工具,對PDF文件進行簽名非常容易。SelectPdf也可以對PDF應用數位簽名,但需要更多的設定和更手動的方法。

如果您想查看更多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("&lt;h2 style='color:red'&gt;SAMPLE&lt;/h2&gt;", 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("&lt;h2 style='color:red'&gt;SAMPLE&lt;/h2&gt;", 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("&lt;h2 style='color:red'&gt;SAMPLE&lt;/h2&gt;", 30, IronPdf.Editing.VerticalAlignment.Middle, IronPdf.Editing.HorizontalAlignment.Center)

pdf.SaveAs("C:\Path\To\Watermarked.pdf")
VB   C#

SelectPdf:

// create a new pdf document
PdfDocument doc = new PdfDocument();

// create a new pdf font
PdfFont font = doc.AddFont(PdfStandardFont.Helvetica);
font.Size = 24;

// add a new page to the document
PdfPage page = doc.AddPage();

// create a new text element and add it to the page
PdfTextElement text = new PdfTextElement(0, 0, Helper.SomeLongText(), font);
page.Add(text);

// get image path
string imgFile = Server.MapPath("~/files/logo.png");

// watermark all pages - add a template containing an image 
// to the bottom right of the page
// the image should repeat on all pdf pages automatically
// the template should be rendered behind the rest of the page elements
PdfTemplate template = doc.AddTemplate(doc.Pages[0].ClientRectangle);
PdfImageElement img = new PdfImageElement(
    doc.Pages[0].ClientRectangle.Width - 300,
    doc.Pages[0].ClientRectangle.Height - 150, imgFile);
img.Transparency = 50;
template.Background = true;
template.Add(img);

// save pdf document
doc.Save(Response, false, "Sample.pdf");

// close pdf document
doc.Close();
// create a new pdf document
PdfDocument doc = new PdfDocument();

// create a new pdf font
PdfFont font = doc.AddFont(PdfStandardFont.Helvetica);
font.Size = 24;

// add a new page to the document
PdfPage page = doc.AddPage();

// create a new text element and add it to the page
PdfTextElement text = new PdfTextElement(0, 0, Helper.SomeLongText(), font);
page.Add(text);

// get image path
string imgFile = Server.MapPath("~/files/logo.png");

// watermark all pages - add a template containing an image 
// to the bottom right of the page
// the image should repeat on all pdf pages automatically
// the template should be rendered behind the rest of the page elements
PdfTemplate template = doc.AddTemplate(doc.Pages[0].ClientRectangle);
PdfImageElement img = new PdfImageElement(
    doc.Pages[0].ClientRectangle.Width - 300,
    doc.Pages[0].ClientRectangle.Height - 150, imgFile);
img.Transparency = 50;
template.Background = true;
template.Add(img);

// save pdf document
doc.Save(Response, false, "Sample.pdf");

// close pdf document
doc.Close();
' create a new pdf document
Dim doc As New PdfDocument()

' create a new pdf font
Dim font As PdfFont = doc.AddFont(PdfStandardFont.Helvetica)
font.Size = 24

' add a new page to the document
Dim page As PdfPage = doc.AddPage()

' create a new text element and add it to the page
Dim text As New PdfTextElement(0, 0, Helper.SomeLongText(), font)
page.Add(text)

' get image path
Dim imgFile As String = Server.MapPath("~/files/logo.png")

' watermark all pages - add a template containing an image 
' to the bottom right of the page
' the image should repeat on all pdf pages automatically
' the template should be rendered behind the rest of the page elements
Dim template As PdfTemplate = doc.AddTemplate(doc.Pages(0).ClientRectangle)
Dim img As New PdfImageElement(doc.Pages(0).ClientRectangle.Width - 300, doc.Pages(0).ClientRectangle.Height - 150, imgFile)
img.Transparency = 50
template.Background = True
template.Add(img)

' save pdf document
doc.Save(Response, False, "Sample.pdf")

' close pdf document
doc.Close()
VB   C#

IronPDF 的內建 浮水印工具 使用 HTML 和 CSS 來簡單地在您的 PDF 頁面上應用浮水印,同時讓您對整個過程有完全的控制,只需幾行代碼即可完成。SelectPdf 也有一個 PDF 浮水印工具,您可以使用它向 PDF 添加自定義浮水印,然而該過程較長,並且可能不如前述的方法簡單易行。

將圖像和文本加蓋到PDF上

IronPDF:

using IronPdf;
using IronPdf.Editing;

ChromePdfRenderer renderer = new ChromePdfRenderer();
PdfDocument pdf = renderer.RenderHtmlAsPdf("&lt;h1&gt;Example HTML Document!&lt;/h1&gt;");

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

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

// Stamp the image stamper
pdf.ApplyStamp(imageStamper, 0);
pdf.SaveAs("stampImage.pdf");
<br>
using IronPdf;
using IronPdf.Editing;

ChromePdfRenderer renderer = new ChromePdfRenderer();
PdfDocument pdf = renderer.RenderHtmlAsPdf("&lt;h1&gt;Example HTML Document!&lt;/h1&gt;");

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

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

// Stamp the image stamper
pdf.ApplyStamp(imageStamper, 0);
pdf.SaveAs("stampImage.pdf");
<br>
Imports IronPdf
Imports IronPdf.Editing

Private renderer As New ChromePdfRenderer()
Private pdf As PdfDocument = renderer.RenderHtmlAsPdf("&lt;h1&gt;Example HTML Document!&lt;/h1&gt;")

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

' Create image stamper
Dim imageStamper As New ImageStamper(New Uri("/img/svgs/iron-pdf-logo.svg")) With {.VerticalAlignment = VerticalAlignment.Top}

' Stamp the image stamper
pdf.ApplyStamp(imageStamper, 0)
pdf.SaveAs("stampImage.pdf")
'INSTANT VB TODO TASK: The following line uses invalid syntax:
'<br>
VB   C#

SelectPdf:

// create a new pdf document
PdfDocument doc = new PdfDocument();

// create a new pdf font
PdfFont font = doc.AddFont(PdfStandardFont.Helvetica);
font.Size = 24;

// add a new page to the document
PdfPage page = doc.AddPage();

// create a new text element and add it to the page
PdfTextElement text = new PdfTextElement(0, 0, Helper.SomeLongText(), font);
page.Add(text);

// get image path
string imgFile = Server.MapPath("~/files/logo.png");

// stamp all pages - add a template containing an image to the bottom right of 
// the page the image should repeat on all pdf pages automatically
PdfTemplate template = doc.AddTemplate(doc.Pages[0].ClientRectangle);
PdfImageElement img = new PdfImageElement(
    doc.Pages[0].ClientRectangle.Width - 300,
    doc.Pages[0].ClientRectangle.Height - 150, imgFile);
template.Add(img);

// save pdf document
doc.Save(Response, false, "Sample.pdf");

// close pdf document
doc.Close();
// create a new pdf document
PdfDocument doc = new PdfDocument();

// create a new pdf font
PdfFont font = doc.AddFont(PdfStandardFont.Helvetica);
font.Size = 24;

// add a new page to the document
PdfPage page = doc.AddPage();

// create a new text element and add it to the page
PdfTextElement text = new PdfTextElement(0, 0, Helper.SomeLongText(), font);
page.Add(text);

// get image path
string imgFile = Server.MapPath("~/files/logo.png");

// stamp all pages - add a template containing an image to the bottom right of 
// the page the image should repeat on all pdf pages automatically
PdfTemplate template = doc.AddTemplate(doc.Pages[0].ClientRectangle);
PdfImageElement img = new PdfImageElement(
    doc.Pages[0].ClientRectangle.Width - 300,
    doc.Pages[0].ClientRectangle.Height - 150, imgFile);
template.Add(img);

// save pdf document
doc.Save(Response, false, "Sample.pdf");

// close pdf document
doc.Close();
' create a new pdf document
Dim doc As New PdfDocument()

' create a new pdf font
Dim font As PdfFont = doc.AddFont(PdfStandardFont.Helvetica)
font.Size = 24

' add a new page to the document
Dim page As PdfPage = doc.AddPage()

' create a new text element and add it to the page
Dim text As New PdfTextElement(0, 0, Helper.SomeLongText(), font)
page.Add(text)

' get image path
Dim imgFile As String = Server.MapPath("~/files/logo.png")

' stamp all pages - add a template containing an image to the bottom right of 
' the page the image should repeat on all pdf pages automatically
Dim template As PdfTemplate = doc.AddTemplate(doc.Pages(0).ClientRectangle)
Dim img As New PdfImageElement(doc.Pages(0).ClientRectangle.Width - 300, doc.Pages(0).ClientRectangle.Height - 150, imgFile)
template.Add(img)

' save pdf document
doc.Save(Response, False, "Sample.pdf")

' close pdf document
doc.Close()
VB   C#

IronPDF 提供了一個強大的工具給 壓印文字和圖像 到您的 PDF 文件上。應用文字或圖片戳記的方法類似於 HTML 和 CSS,這意味著您將完全控制蓋章過程。SelectPdf 的方法較長,過程涉及更多手動工作。

如果您想瞭解更多關於 IronPDF 的蓋章工具,請務必查看其便捷的 操作指南 指南。

DOCX 到 PDF 轉換

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");
<br>
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");
<br>
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")
'INSTANT VB TODO TASK: The following line uses invalid syntax:
'<br>
VB   C#

SelectPdf:

SelectPdf不支持直接將DOCX轉換為PDF。

IronPDF支持直接轉換 DOCX 檔案轉 PDF透過這個功能,您只需幾行程式碼即可將DOCX轉換為PDF,並且不會失去檔案的任何品質。然而,SelectPdf沒有提供內建的DOCX到PDF的支援。

如需了解更多有關IronPDF的DOCX轉PDF功能,請務必查看 操作指南 此主題的指南。

功能比較總結

IronPDF 與 SelectPDF 的比較:圖 1

欲了解詳細的程式碼範例,請訪問 IronPDF 範例.

定價和授權:IronPDF 與 SelectPdf 比較

IronPDF 價格與授權

IronPDF 具有不同层级和额外功能的许可证可供购买。开发人员还可以购买 IronSuite ,讓您以兩個產品的價格獲得所有IronSoftware的產品。如果您還沒準備購買授權,IronPDF提供 免費試用 持續 30 天。

  • 永久授權: 提供多種永久授權,取決於團隊規模、項目需求和地點數量。每種類型的授權都包括電子郵件支持。
  • Lite License:此授權價格為 $749,支持一名開發人員、一個地點和一個項目。
  • Plus License: 支持三名開發人員、三個地點和三個項目,是由 Lite License 升級而來,價格為 $1,499。Plus License 除了基本的電子郵件支持,還提供聊天支持和電話支持。
  • Professional License: 適合較大團隊,支持十名開發人員、十個地點和十個項目,價格為 $2,999。它提供與前幾個層級相同的聯繫支持渠道,還提供屏幕共享支持。
  • 免版稅重發布: IronPDF 的授權還提供免版稅重發布保障,需額外支付 $1,999。
  • 不間斷產品支持: IronPDF 提供持續的產品更新、安全功能升級以及來自工程團隊的支持,年費為 $999 或一次性支付 $1,999 以獲得五年的覆蓋。
  • Iron Suite:只需 $1,498,即可獲得 Iron Software 旗下所有產品的使用權,包括 IronPDF、IronOCR、IronWord、IronXL、IronBarcode、IronQR、IronZIP、IronPrint 和 IronWebScraper。

IronPDF與SelectPDF的比較:圖2

SelectPdf

SelectPdf 提供一系列包含一年的維護計劃的永久性許可級別。

  • 單一開發者許可證: $499,支持一名開發者和一台部署機器
  • 單一開發者OEM許可證: $799,支持一名開發者和無限部署機器
  • 5開發者許可證: $799,支持最多五名開發者和最多10台部署機器
  • 5開發者OEM許可證: $1,099,支持最多五名開發者和無限部署機器
  • 企業許可證: $1,199,支持無限開發者和最多一百台部署機器
  • 企業OEM許可證: $1,599,支持無限開發者和無限部署機器

文檔和支持:IronPDF vs. SelectPdf

IronPDF

IronPDF 在提供廣泛的文件及支援方面表現優異:

  • 詳細文件:涵蓋所有功能的詳細且使用者友好的文件。
  • 24/5 支援:提供活躍的工程師支援。
  • 視頻教程:在 YouTube 上提供逐步視頻指南。
  • 社區論壇:活躍的社區提供額外支援。
  • 定期更新:每月產品更新確保最新功能和安全性修補程式。

想了解更多資訊,請參考 IronPDF 的詳細資訊。 文檔, 並造訪 IronSoftware YouTube 頻道.

SelectPdf 文件和支援

  • 詳細文件:涵蓋 SelectPdf 的所有功能,並提供程式碼範例。
  • 電子郵件支援:提供技術和授權查詢服務。
  • 專業服務:針對複雜的實施提供付費支援,例如他們的一年期維護計劃。

結論

擁有合適的PDF庫來滿足您的PDF專案需求在處理PDF時至關重要。今天我們看到了IronPDF和SelectPdf的實際應用,並仔細查看了這兩個庫。SelectPdf提供了一系列穩固的功能來處理PDF,但其中許多功能可能比IronPDF更需要工作來實現。

IronPDF突顯了其作為一個多功能且全面的解決方案,適合需要強大PDF功能的.NET開發人員。其豐富的功能、與現代.NET框架的兼容性以及出色的支持,使其成為開發人員工具包中的強大工具。

< 上一頁
IronPDF與Devexpress PDF Viewer之間的比較
下一個 >
IronPDF 和 EvoPdf:比較

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

免費 NuGet 下載 總下載次數: 10,993,239 查看許可證 >