Test in a live environment
Test in production without watermarks.
Works wherever you need it to.
As C# developers, dealing with PDFs is a common part of our job, especially when building applications that need to generate, edit, or display documents. That's why having a good PDF library is crucial. These libraries save us time and hassle by providing built-in functions for complex tasks like converting documents, editing text, and handling images within PDFs. Without them, we'd have to write all that code from scratch, which is not only time-consuming but also prone to errors.
In this comparison, we're looking at two popular PDF libraries: IronPDF and Apryse C#. IronPDF is known for its robust features that make working with PDFs in a .NET environment a breeze, from converting HTML to PDF to advanced document editing. Apryse C#, on the other hand, offers a streamlined approach to PDF manipulation, focusing on ease of use and efficiency. We'll dive into the specifics of what each library offers to help you decide which one might be the best fit for your project.
Apryse C# is a comprehensive PDF library for .NET applications, designed to streamline the process of PDF manipulation within C# environments. It is previously known as PDFTron SDK. Its broad range of features and tools makes it an invaluable asset for developers looking to handle PDFs with precision and ease.
IronPDF stands out as a versatile and powerful PDF library tailored for .NET developers. It simplifies the complex process of PDF manipulation, allowing for the creation, editing, and conversion of PDF documents directly within C# applications. IronPDF is available in different programming languages like Java, Python, and C#. IronPDF is designed to cater to a wide range of PDF processing needs, making it a go-to solution for developers seeking efficiency and reliability.
Creating a console application in Visual Studio is a straightforward process that lays the foundation for any .NET development project, including those involving PDF manipulations with libraries like IronPDF or Apryse C#. Here's how to get started:
Open Visual Studio on your computer. If you haven’t installed Visual Studio yet, download and install it from the official Microsoft website, choosing a version that suits your needs.
Once Visual Studio is open, select the "Create a new project" option from the initial dashboard.
In the "Create a new project" window, you’ll see a variety of project templates. Type “Console” in the search box or find the “Console Application” template from the list. Make sure to select the template specific to C#, not another language.
After selecting the “Console Application” template, click the "Next" button. You'll be prompted to configure your new project:
After configuring your project settings, click the "Create" button. Visual Studio will set up a new console application project with a default Program.cs file.
Take a moment to explore the generated project structure in the Solution Explorer pane. You’ll primarily work with the Program.cs file for a console application, which is where you’ll write your C# code.
Integrating the IronPDF library into your .NET project allows you to leverage its comprehensive PDF manipulation capabilities. There are several methods to install IronPDF, ensuring flexibility based on your preferred workflow or development environment setup.
The NuGet Package Manager in Visual Studio provides a user-friendly interface for managing libraries and dependencies.
For those who prefer using the command line, the Package Manager Console in Visual Studio offers a direct way to install packages.
Install-Package IronPdf
This command will download and install the latest version of IronPDF into your project.
If you prefer to manually download the package before integrating it into your project, you can do so from the NuGet website.
Each of these methods will successfully integrate IronPDF into your .NET project, allowing you to start utilizing its powerful PDF processing features.
To integrate Apryse C# into your C# project, you have a few options depending on whether you're working with .NET Framework or .NET Core, as well as your development environment preferences. Below are generalized steps based on information from Apryse documentation and setup guides:
There are sample folders in the SDK. You can open and run these sample solutions directly.
IronPDF excels in converting HTML to PDF documents. This feature is crucial for web applications needing to generate reports, invoices, or snapshots of web pages as PDF files. The library accurately renders HTML, CSS, and JavaScript, capturing the layout and styles of web content in the generated PDF.
Converting an HTML string directly to a PDF allows for dynamic PDF creation from HTML content generated within your application or stored in a variable. This is particularly useful for generating customized reports, receipts, or documents based on user input or application data.
using IronPdf;
// Disable local disk access or cross-origin requests
Installation.EnableWebSecurity = true;
IronPdf.License.LicenseKey = "License-Key goes here";
// Instantiate Renderer
var renderer = new ChromePdfRenderer();
// Create a different HTML string
string htmlContent = @"
<!DOCTYPE html>
<html lang='en'>
<head>
<meta charset='UTF-8'>
<meta name='viewport' content='width=device-width, initial-scale=1.0'>
<title>My PDF</title>
<style>
body {
font-family: Arial, sans-serif;
}
h1 {
color: #333;
text-align: center;
}
p {
color: #666;
text-align: justify;
}
</style>
</head>
<body>
<h1>Welcome to My PDF</h1>
<p>This is a sample paragraph demonstrating how to create a PDF from HTML using IronPdf in C#.</p>
<p>You can add more content here as needed.</p>
</body>
</html>";
// Create a PDF from the HTML string using C#
var pdf = renderer.RenderHtmlAsPdf(htmlContent);
// Export to a file or Stream
pdf.SaveAs("output.pdf");
using IronPdf;
// Disable local disk access or cross-origin requests
Installation.EnableWebSecurity = true;
IronPdf.License.LicenseKey = "License-Key goes here";
// Instantiate Renderer
var renderer = new ChromePdfRenderer();
// Create a different HTML string
string htmlContent = @"
<!DOCTYPE html>
<html lang='en'>
<head>
<meta charset='UTF-8'>
<meta name='viewport' content='width=device-width, initial-scale=1.0'>
<title>My PDF</title>
<style>
body {
font-family: Arial, sans-serif;
}
h1 {
color: #333;
text-align: center;
}
p {
color: #666;
text-align: justify;
}
</style>
</head>
<body>
<h1>Welcome to My PDF</h1>
<p>This is a sample paragraph demonstrating how to create a PDF from HTML using IronPdf in C#.</p>
<p>You can add more content here as needed.</p>
</body>
</html>";
// Create a PDF from the HTML string using C#
var pdf = renderer.RenderHtmlAsPdf(htmlContent);
// Export to a file or Stream
pdf.SaveAs("output.pdf");
Imports IronPdf
' Disable local disk access or cross-origin requests
Installation.EnableWebSecurity = True
IronPdf.License.LicenseKey = "License-Key goes here"
' Instantiate Renderer
Dim renderer = New ChromePdfRenderer()
' Create a different HTML string
Dim htmlContent As String = "
<!DOCTYPE html>
<html lang='en'>
<head>
<meta charset='UTF-8'>
<meta name='viewport' content='width=device-width, initial-scale=1.0'>
<title>My PDF</title>
<style>
body {
font-family: Arial, sans-serif;
}
h1 {
color: #333;
text-align: center;
}
p {
color: #666;
text-align: justify;
}
</style>
</head>
<body>
<h1>Welcome to My PDF</h1>
<p>This is a sample paragraph demonstrating how to create a PDF from HTML using IronPdf in C#.</p>
<p>You can add more content here as needed.</p>
</body>
</html>"
' Create a PDF from the HTML string using C#
Dim pdf = renderer.RenderHtmlAsPdf(htmlContent)
' Export to a file or Stream
pdf.SaveAs("output.pdf")
When you have an HTML file stored on disk, IronPDF can convert this file into a PDF document. This method is ideal for converting existing HTML documents, templates, or reports that are saved as files in your project or on your server.
using IronPdf;
IronPdf.License.LicenseKey = "License-Key goes here";
// Disable local disk access or cross-origin requests
Installation.EnableWebSecurity = true;
// Instantiate Renderer
var renderer = new ChromePdfRenderer();
// Create a PDF from the HTML string using C#
var pdf = renderer.RenderHtmlFileAsPdf("invoice.html");
// Export to a file or Stream
pdf.SaveAs("file.pdf");
using IronPdf;
IronPdf.License.LicenseKey = "License-Key goes here";
// Disable local disk access or cross-origin requests
Installation.EnableWebSecurity = true;
// Instantiate Renderer
var renderer = new ChromePdfRenderer();
// Create a PDF from the HTML string using C#
var pdf = renderer.RenderHtmlFileAsPdf("invoice.html");
// Export to a file or Stream
pdf.SaveAs("file.pdf");
Imports IronPdf
IronPdf.License.LicenseKey = "License-Key goes here"
' Disable local disk access or cross-origin requests
Installation.EnableWebSecurity = True
' Instantiate Renderer
Dim renderer = New ChromePdfRenderer()
' Create a PDF from the HTML string using C#
Dim pdf = renderer.RenderHtmlFileAsPdf("invoice.html")
' Export to a file or Stream
pdf.SaveAs("file.pdf")
IronPDF can convert a live webpage into a PDF document by providing the URL. This feature is extremely useful for capturing the current state of a webpage, including complex layouts, CSS, and JavaScript-generated content.
using IronPdf;
IronPdf.License.LicenseKey = "License-Key goes here";
// Disable local disk access or cross-origin requests
Installation.EnableWebSecurity = true;
// Instantiate Renderer
var renderer = new ChromePdfRenderer();
// Create a PDF from the HTML string using C#
var pdf = renderer.RenderUrlAsPdf("https://dotnet.microsoft.com/en-us/download/dotnet-framework");
// Export to a file or Stream
pdf.SaveAs("url.pdf");
using IronPdf;
IronPdf.License.LicenseKey = "License-Key goes here";
// Disable local disk access or cross-origin requests
Installation.EnableWebSecurity = true;
// Instantiate Renderer
var renderer = new ChromePdfRenderer();
// Create a PDF from the HTML string using C#
var pdf = renderer.RenderUrlAsPdf("https://dotnet.microsoft.com/en-us/download/dotnet-framework");
// Export to a file or Stream
pdf.SaveAs("url.pdf");
Imports IronPdf
IronPdf.License.LicenseKey = "License-Key goes here"
' Disable local disk access or cross-origin requests
Installation.EnableWebSecurity = True
' Instantiate Renderer
Dim renderer = New ChromePdfRenderer()
' Create a PDF from the HTML string using C#
Dim pdf = renderer.RenderUrlAsPdf("https://dotnet.microsoft.com/en-us/download/dotnet-framework")
' Export to a file or Stream
pdf.SaveAs("url.pdf")
With IronPDF, combining multiple PDF documents into a single file or dividing a PDF into several smaller documents is straightforward. This functionality is essential for document management systems where organizing and structuring PDF content is necessary.
using IronPdf;
IronPdf.License.LicenseKey = "License-Key goes here";
// Disable local disk access or cross-origin requests
Installation.EnableWebSecurity = true;
var html_a = @"
<h1>PDF A</h1>
<p>This is the content of PDF A.</p>
<p>This is the first page of PDF A.</p>
<div style='page-break-after: always;'></div>
<p>This is the second page of PDF A.</p>";
var html_b = @"
<h1>PDF B</h1>
<p>This is the content of PDF B.</p>
<p>This is the first page of PDF B.</p>
<div style='page-break-after: always;'></div>
<p>This is the second page of PDF B.</p>";
var renderer = new ChromePdfRenderer();
var pdfdoc_a = renderer.RenderHtmlAsPdf(html_a);
var pdfdoc_b = renderer.RenderHtmlAsPdf(html_b);
var merged = PdfDocument.Merge(pdfdoc_a, pdfdoc_b);
merged.SaveAs("Merged.pdf");
using IronPdf;
IronPdf.License.LicenseKey = "License-Key goes here";
// Disable local disk access or cross-origin requests
Installation.EnableWebSecurity = true;
var html_a = @"
<h1>PDF A</h1>
<p>This is the content of PDF A.</p>
<p>This is the first page of PDF A.</p>
<div style='page-break-after: always;'></div>
<p>This is the second page of PDF A.</p>";
var html_b = @"
<h1>PDF B</h1>
<p>This is the content of PDF B.</p>
<p>This is the first page of PDF B.</p>
<div style='page-break-after: always;'></div>
<p>This is the second page of PDF B.</p>";
var renderer = new ChromePdfRenderer();
var pdfdoc_a = renderer.RenderHtmlAsPdf(html_a);
var pdfdoc_b = renderer.RenderHtmlAsPdf(html_b);
var merged = PdfDocument.Merge(pdfdoc_a, pdfdoc_b);
merged.SaveAs("Merged.pdf");
Imports IronPdf
IronPdf.License.LicenseKey = "License-Key goes here"
' Disable local disk access or cross-origin requests
Installation.EnableWebSecurity = True
Dim html_a = "
<h1>PDF A</h1>
<p>This is the content of PDF A.</p>
<p>This is the first page of PDF A.</p>
<div style='page-break-after: always;'></div>
<p>This is the second page of PDF A.</p>"
Dim html_b = "
<h1>PDF B</h1>
<p>This is the content of PDF B.</p>
<p>This is the first page of PDF B.</p>
<div style='page-break-after: always;'></div>
<p>This is the second page of PDF B.</p>"
Dim renderer = New ChromePdfRenderer()
Dim pdfdoc_a = renderer.RenderHtmlAsPdf(html_a)
Dim pdfdoc_b = renderer.RenderHtmlAsPdf(html_b)
Dim merged = PdfDocument.Merge(pdfdoc_a, pdfdoc_b)
merged.SaveAs("Merged.pdf")
IronPDF allows you to add watermarks to PDF pages, which is useful for branding or marking documents as confidential. This feature supports both text and image watermarks, providing flexibility in how watermarks are applied and displayed.
using IronPdf;
IronPdf.License.LicenseKey = "License-Key goes here";
// Disable local disk access or cross-origin requests
Installation.EnableWebSecurity = true;
// 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("Watermarked.pdf");
using IronPdf;
IronPdf.License.LicenseKey = "License-Key goes here";
// Disable local disk access or cross-origin requests
Installation.EnableWebSecurity = true;
// 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("Watermarked.pdf");
Imports IronPdf
IronPdf.License.LicenseKey = "License-Key goes here"
' Disable local disk access or cross-origin requests
Installation.EnableWebSecurity = True
' Stamps a Watermark onto a new or existing PDF
Dim renderer = New ChromePdfRenderer()
Dim 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("Watermarked.pdf")
IronPDF supports working with interactive PDF forms. It enables the creation, filling, and submission of PDF forms programmatically. This is particularly useful for applications that need to automate form processing or integrate form data collection into their workflows.
using IronPdf;
IronPdf.License.LicenseKey = "License-Key goes here";
// Disable local disk access or cross-origin requests
Installation.EnableWebSecurity = true;
const string differentFormHtml = @"
<html>
<body>
<h2>Employee Information Form</h2>
<form>
First name: <br>
Last name: <br>
<br>
<p>Please select your department:</p>
<select name='department'>
<option value='HR'>HR</option>
<option value='Finance'>Finance</option>
<option value='IT'>IT</option>
<option value='Marketing'>Marketing</option>
</select>
<br>
<br>
<p>Please select your employment status:</p>
<label for='fulltime'>Full-time</label> <br>
<label for='parttime'>Part-time</label> <br>
<br>
<p>Please select your skills:</p>
<label for='skill1'> Programming</label><br>
<label for='skill2'> Design</label><br>
<label for='skill3'> Marketing</label><br>
</form>
</body>
</html>";
// Instantiate Renderer
var renderer = new ChromePdfRenderer();
renderer.RenderingOptions.CreatePdfFormsFromHtml = true;
renderer.RenderHtmlAsPdf(differentFormHtml).SaveAs("EmployeeInfoForm.pdf");
using IronPdf;
IronPdf.License.LicenseKey = "License-Key goes here";
// Disable local disk access or cross-origin requests
Installation.EnableWebSecurity = true;
const string differentFormHtml = @"
<html>
<body>
<h2>Employee Information Form</h2>
<form>
First name: <br>
Last name: <br>
<br>
<p>Please select your department:</p>
<select name='department'>
<option value='HR'>HR</option>
<option value='Finance'>Finance</option>
<option value='IT'>IT</option>
<option value='Marketing'>Marketing</option>
</select>
<br>
<br>
<p>Please select your employment status:</p>
<label for='fulltime'>Full-time</label> <br>
<label for='parttime'>Part-time</label> <br>
<br>
<p>Please select your skills:</p>
<label for='skill1'> Programming</label><br>
<label for='skill2'> Design</label><br>
<label for='skill3'> Marketing</label><br>
</form>
</body>
</html>";
// Instantiate Renderer
var renderer = new ChromePdfRenderer();
renderer.RenderingOptions.CreatePdfFormsFromHtml = true;
renderer.RenderHtmlAsPdf(differentFormHtml).SaveAs("EmployeeInfoForm.pdf");
Imports IronPdf
IronPdf.License.LicenseKey = "License-Key goes here"
' Disable local disk access or cross-origin requests
Installation.EnableWebSecurity = True
Const differentFormHtml As String = "
<html>
<body>
<h2>Employee Information Form</h2>
<form>
First name: <br>
Last name: <br>
<br>
<p>Please select your department:</p>
<select name='department'>
<option value='HR'>HR</option>
<option value='Finance'>Finance</option>
<option value='IT'>IT</option>
<option value='Marketing'>Marketing</option>
</select>
<br>
<br>
<p>Please select your employment status:</p>
<label for='fulltime'>Full-time</label> <br>
<label for='parttime'>Part-time</label> <br>
<br>
<p>Please select your skills:</p>
<label for='skill1'> Programming</label><br>
<label for='skill2'> Design</label><br>
<label for='skill3'> Marketing</label><br>
</form>
</body>
</html>"
' Instantiate Renderer
Dim renderer = New ChromePdfRenderer()
renderer.RenderingOptions.CreatePdfFormsFromHtml = True
renderer.RenderHtmlAsPdf(differentFormHtml).SaveAs("EmployeeInfoForm.pdf")
IronPDF provides features to secure PDF documents, including the ability to encrypt PDF files, set permissions, and add digital signatures. This ensures that sensitive information in PDF documents is protected and that document integrity is maintained.
using IronPdf;
IronPdf.License.LicenseKey = "License-Key" goes here;
// Disable local disk access or cross-origin requests
Installation.EnableWebSecurity = true;
var pdf = PdfDocument.FromFile("invoice.pdf");
// Change or set the document encryption password
pdf.SecuritySettings.OwnerPassword = "top-secret"; // password to edit the pdf
pdf.SecuritySettings.UserPassword = "sharable"; // password to open the pdf
pdf.SaveAs("secured.pdf");
using IronPdf;
IronPdf.License.LicenseKey = "License-Key" goes here;
// Disable local disk access or cross-origin requests
Installation.EnableWebSecurity = true;
var pdf = PdfDocument.FromFile("invoice.pdf");
// Change or set the document encryption password
pdf.SecuritySettings.OwnerPassword = "top-secret"; // password to edit the pdf
pdf.SecuritySettings.UserPassword = "sharable"; // password to open the pdf
pdf.SaveAs("secured.pdf");
Imports IronPdf
IronPdf.License.LicenseKey = "License-Key" goes here
' Disable local disk access or cross-origin requests
Installation.EnableWebSecurity = True
Dim pdf = PdfDocument.FromFile("invoice.pdf")
' Change or set the document encryption password
pdf.SecuritySettings.OwnerPassword = "top-secret" ' password to edit the pdf
pdf.SecuritySettings.UserPassword = "sharable" ' password to open the pdf
pdf.SaveAs("secured.pdf")
IronPDF goes beyond basic PDF editing by offering advanced editing capabilities. This includes adding headers and footers, customizing page layout and design, and embedding images and fonts. These features allow for dynamic PDF generation and customization according to specific application requirements.
using IronPdf;
IronPdf.License.LicenseKey = "License-Key goes here";
// Disable local disk access or cross-origin requests
Installation.EnableWebSecurity = true;
// Instantiate Renderer
var renderer = new IronPdf.ChromePdfRenderer();
var multi_page_html = @"
<p> This is 1st Page</p>
<div style = 'page-break-after: always;' ></div>
<p> This is 2nd Page</p>
<div style = 'page-break-after: always;' ></div>
<p> This is 3rd Page</p>
<div style = 'page-break-after: always;' ></div>
<p> This is 4th Page</p>
<div style = 'page-break-after: always;' ></div>
<p> This is 5th Page</p>
<div style = 'page-break-after: always;' ></div>
<p> This is 6th Page</p>
<div style = 'page-break-after: always;' ></div>
<p> This is 7th Page</p>";
// Create a PDF or Load an existing PDF using IronPdf.PdfDocument.Load()
var pdfdoc = renderer.RenderHtmlAsPdf(multi_page_html);
// Create a Header for the first page only
var firstPageHeader = new HtmlHeaderFooter();
firstPageHeader.HtmlFragment = "This is the First Page Header";
pdfdoc.AddHtmlHeaders(firstPageHeader, 1);
pdfdoc.SaveAs("PagesWithHeaders.pdf");
using IronPdf;
IronPdf.License.LicenseKey = "License-Key goes here";
// Disable local disk access or cross-origin requests
Installation.EnableWebSecurity = true;
// Instantiate Renderer
var renderer = new IronPdf.ChromePdfRenderer();
var multi_page_html = @"
<p> This is 1st Page</p>
<div style = 'page-break-after: always;' ></div>
<p> This is 2nd Page</p>
<div style = 'page-break-after: always;' ></div>
<p> This is 3rd Page</p>
<div style = 'page-break-after: always;' ></div>
<p> This is 4th Page</p>
<div style = 'page-break-after: always;' ></div>
<p> This is 5th Page</p>
<div style = 'page-break-after: always;' ></div>
<p> This is 6th Page</p>
<div style = 'page-break-after: always;' ></div>
<p> This is 7th Page</p>";
// Create a PDF or Load an existing PDF using IronPdf.PdfDocument.Load()
var pdfdoc = renderer.RenderHtmlAsPdf(multi_page_html);
// Create a Header for the first page only
var firstPageHeader = new HtmlHeaderFooter();
firstPageHeader.HtmlFragment = "This is the First Page Header";
pdfdoc.AddHtmlHeaders(firstPageHeader, 1);
pdfdoc.SaveAs("PagesWithHeaders.pdf");
Imports IronPdf
IronPdf.License.LicenseKey = "License-Key goes here"
' Disable local disk access or cross-origin requests
Installation.EnableWebSecurity = True
' Instantiate Renderer
Dim renderer = New IronPdf.ChromePdfRenderer()
Dim multi_page_html = "
<p> This is 1st Page</p>
<div style = 'page-break-after: always;' ></div>
<p> This is 2nd Page</p>
<div style = 'page-break-after: always;' ></div>
<p> This is 3rd Page</p>
<div style = 'page-break-after: always;' ></div>
<p> This is 4th Page</p>
<div style = 'page-break-after: always;' ></div>
<p> This is 5th Page</p>
<div style = 'page-break-after: always;' ></div>
<p> This is 6th Page</p>
<div style = 'page-break-after: always;' ></div>
<p> This is 7th Page</p>"
' Create a PDF or Load an existing PDF using IronPdf.PdfDocument.Load()
Dim pdfdoc = renderer.RenderHtmlAsPdf(multi_page_html)
' Create a Header for the first page only
Dim firstPageHeader = New HtmlHeaderFooter()
firstPageHeader.HtmlFragment = "This is the First Page Header"
pdfdoc.AddHtmlHeaders(firstPageHeader, 1)
pdfdoc.SaveAs("PagesWithHeaders.pdf")
Apryse C# enables developers to add annotations and markup to PDF documents programmatically. This includes text annotations, highlights, underlines, and shapes, which are essential for document review processes or adding supplementary information to PDFs.
using pdftron;
using pdftron.PDF;
using pdftron.SDF;
class Program
{
static void Main()
{
PDFNet.Initialize("License");
using (PDFDoc doc = new PDFDoc("input.pdf"))
{
Page page = doc.GetPage(1);
Text txt = Text.Create(doc, new Rect(10, 20, 30, 40));
txt.SetIcon("UserIcon");
txt.SetContents("It's an annotation!");
page.AnnotPushBack(txt);
page.AnnotPushBack(annot);
doc.Save("output.pdf", SDFDoc.SaveOptions.e_linearized);
}
}
}
using pdftron;
using pdftron.PDF;
using pdftron.SDF;
class Program
{
static void Main()
{
PDFNet.Initialize("License");
using (PDFDoc doc = new PDFDoc("input.pdf"))
{
Page page = doc.GetPage(1);
Text txt = Text.Create(doc, new Rect(10, 20, 30, 40));
txt.SetIcon("UserIcon");
txt.SetContents("It's an annotation!");
page.AnnotPushBack(txt);
page.AnnotPushBack(annot);
doc.Save("output.pdf", SDFDoc.SaveOptions.e_linearized);
}
}
}
Imports pdftron
Imports pdftron.PDF
Imports pdftron.SDF
Friend Class Program
Shared Sub Main()
PDFNet.Initialize("License")
Using doc As New PDFDoc("input.pdf")
Dim page As Page = doc.GetPage(1)
Dim txt As Text = Text.Create(doc, New Rect(10, 20, 30, 40))
txt.SetIcon("UserIcon")
txt.SetContents("It's an annotation!")
page.AnnotPushBack(txt)
page.AnnotPushBack(annot)
doc.Save("output.pdf", SDFDoc.SaveOptions.e_linearized)
End Using
End Sub
End Class
With Apryse C#, developers can convert various document formats to PDF, including Office documents, images, and HTML. This feature is vital for applications that require uniform document formats for archiving, sharing, or displaying.
using pdftron;
using pdftron.PDF;
class Program
{
static void Main()
{
PDFNet.Initialize();
PDFDoc pdfdoc = new PDFDoc();
Convert.ToPdf(pdfdoc, "input.docx");
pdfdoc.Save("output.pdf", SDFDoc.SaveOptions.e_linearized);
}
}
using pdftron;
using pdftron.PDF;
class Program
{
static void Main()
{
PDFNet.Initialize();
PDFDoc pdfdoc = new PDFDoc();
Convert.ToPdf(pdfdoc, "input.docx");
pdfdoc.Save("output.pdf", SDFDoc.SaveOptions.e_linearized);
}
}
Imports pdftron
Imports pdftron.PDF
Friend Class Program
Shared Sub Main()
PDFNet.Initialize()
Dim pdfdoc As New PDFDoc()
Convert.ToPdf(pdfdoc, "input.docx")
pdfdoc.Save("output.pdf", SDFDoc.SaveOptions.e_linearized)
End Sub
End Class
Apryse C# excels in extracting text, images, and other content from PDF documents. This capability is crucial for content analysis, data extraction, and information retrieval applications, enabling the processing of PDF content for various purposes.
using pdftron;
using pdftron.PDF;
using pdftron.SDF;
class Program
{
static void Main()
{
PDFNet.Initialize();
using (PDFDoc doc = new PDFDoc("input.pdf"))
{
PageIterator itr = doc.GetPageIterator();
for (; itr.HasNext(); itr.Next())
{
Page page = itr.Current();
TextExtractor txt = new TextExtractor();
txt.Begin(page);
Console.WriteLine(txt.GetAsText());
}
}
}
}
using pdftron;
using pdftron.PDF;
using pdftron.SDF;
class Program
{
static void Main()
{
PDFNet.Initialize();
using (PDFDoc doc = new PDFDoc("input.pdf"))
{
PageIterator itr = doc.GetPageIterator();
for (; itr.HasNext(); itr.Next())
{
Page page = itr.Current();
TextExtractor txt = new TextExtractor();
txt.Begin(page);
Console.WriteLine(txt.GetAsText());
}
}
}
}
Imports pdftron
Imports pdftron.PDF
Imports pdftron.SDF
Friend Class Program
Shared Sub Main()
PDFNet.Initialize()
Using doc As New PDFDoc("input.pdf")
Dim itr As PageIterator = doc.GetPageIterator()
Do While itr.HasNext()
Dim page As Page = itr.Current()
Dim txt As New TextExtractor()
txt.Begin(page)
Console.WriteLine(txt.GetAsText())
itr.Next()
Loop
End Using
End Sub
End Class
Apryse C# provides comprehensive tools for securing PDF documents. Developers can apply password protection, encrypt documents, and manage user permissions, ensuring that sensitive information is safeguarded.
using pdftron;
using pdftron.SDF;
using pdftron.PDF;
class Program
{
static void Main()
{
PDFNet.Initialize();
using (PDFDoc doc = new PDFDoc("input.pdf"))
{
doc.InitSecurityHandler();
SecurityHandler newHandler = new SecurityHandler();
newHandler.ChangeUserPassword("new_password");
newHandler.SetPermission(SecurityHandler.Permission.e_print, true);
doc.SetSecurityHandler(newHandler);
doc.Save("output.pdf", SDFDoc.SaveOptions.e_linearized);
}
}
}
using pdftron;
using pdftron.SDF;
using pdftron.PDF;
class Program
{
static void Main()
{
PDFNet.Initialize();
using (PDFDoc doc = new PDFDoc("input.pdf"))
{
doc.InitSecurityHandler();
SecurityHandler newHandler = new SecurityHandler();
newHandler.ChangeUserPassword("new_password");
newHandler.SetPermission(SecurityHandler.Permission.e_print, true);
doc.SetSecurityHandler(newHandler);
doc.Save("output.pdf", SDFDoc.SaveOptions.e_linearized);
}
}
}
Imports pdftron
Imports pdftron.SDF
Imports pdftron.PDF
Friend Class Program
Shared Sub Main()
PDFNet.Initialize()
Using doc As New PDFDoc("input.pdf")
doc.InitSecurityHandler()
Dim newHandler As New SecurityHandler()
newHandler.ChangeUserPassword("new_password")
newHandler.SetPermission(SecurityHandler.Permission.e_print, True)
doc.SetSecurityHandler(newHandler)
doc.Save("output.pdf", SDFDoc.SaveOptions.e_linearized)
End Using
End Sub
End Class
Apryse C# also supports redacting sensitive information from PDF documents, an essential feature for compliance and privacy concerns. This allows developers to permanently remove or obscure text and images within a PDF.
using pdftron;
using pdftron.PDF;
using pdftron.SDF;
class Program
{
static void Main()
{
PDFNet.Initialize();
using (PDFDoc doc = new PDFDoc("input.pdf"))
{
Redactor.Redaction [] redactions = {
new Redactor.Redaction(1, new Rect(100, 100, 200, 200), false, "redacted"),
};
Redactor.Redact(doc, redactions);
doc.Save("output.pdf", SDFDoc.SaveOptions.e_linearized);
}
}
}
using pdftron;
using pdftron.PDF;
using pdftron.SDF;
class Program
{
static void Main()
{
PDFNet.Initialize();
using (PDFDoc doc = new PDFDoc("input.pdf"))
{
Redactor.Redaction [] redactions = {
new Redactor.Redaction(1, new Rect(100, 100, 200, 200), false, "redacted"),
};
Redactor.Redact(doc, redactions);
doc.Save("output.pdf", SDFDoc.SaveOptions.e_linearized);
}
}
}
Imports pdftron
Imports pdftron.PDF
Imports pdftron.SDF
Friend Class Program
Shared Sub Main()
PDFNet.Initialize()
Using doc As New PDFDoc("input.pdf")
Dim redactions() As Redactor.Redaction = { New Redactor.Redaction(1, New Rect(100, 100, 200, 200), False, "redacted")}
Redactor.Redact(doc, redactions)
doc.Save("output.pdf", SDFDoc.SaveOptions.e_linearized)
End Using
End Sub
End Class
Documentation: IronPDF offers comprehensive documentation that covers a wide range of topics, from getting started guides to advanced features like HTML to PDF conversion, PDF editing, merging, splitting, and security. The documentation is designed to be easy to follow, with plenty of code examples and explanations that guide developers through the process of implementing various PDF-related functionalities in their .NET applications.
Support: For developers who need assistance, IronPDF provides support through various channels. This includes email support, ticket support, and live engineering support chat where you can get in touch with their technical support team for help with specific issues. You can also provide feedback using a support system.
Documentation: Apryse C# (formerly known as PDFTron for .NET) boasts detailed documentation that includes a comprehensive API reference, developer guides, and sample code for a broad spectrum of PDF manipulation tasks.
Support: Apryse provides a support system for developers, featuring direct email support with their technical team for troubleshooting and assistance with implementation questions. You can also ask questions on stack overflow.
IronPDF offers several licensing options tailored to different project needs, including Lite, Plus, and Professional licenses, with pricing starting at $749 for a Lite license. These licenses vary based on the number of developers, locations, and projects they cover. Additionally, IronPDF provides options for royalty-free redistribution and extended support and updates, with specific costs for these add-ons.
IronPDF offers a range of perpetual license options for developers:
They also offer a monthly subscription at $500 per month, including 10,000 API calls, with additional calls at $0.02 each. For unlimited use, IronPDF provides an enterprise solution with a request for a quote. This solution includes an unlimited perpetual license and unlimited API calls, among other features.
Apryse C# provides a customizable pricing model that adjusts based on specific project requirements, including features, document volume, and deployment scenarios. You have to contact their sales team to get pricing information.
In conclusion, IronPDF and Apryse C# each bring powerful capabilities to the table for .NET developers working with PDFs. IronPDF, however, provides an edge with its extensive PDF manipulation features. It shines with its ability to handle comprehensive tasks such as extensive editing, merging PDFs that adds to its appeal. With the Iron Suite package, developers can access a suite of tools at a cost-effective price point, equipping them with a robust set of utilities for various development needs.
IronPDF stands out for its overall versatility and value proposition in most PDF processing scenarios. The final decision would ideally be based on the project requirements and the specific features needed by the developers.
9 .NET API products for your office documents