Test in a live environment
Test in production without watermarks.
Works wherever you need it to.
PDF, short for Portable Document Format, is a file type created by Adobe to ensure uniformity in document sharing. This format keeps the layout, text, and images consistent across various devices and operating systems. PDFs are known for their security, interactive features, and compact size, making them perfect for distributing documents without altering the original content.
For developers using C#, PDF libraries provide PDF Solutions for working with PDF files. These libraries enable document creation, content modification, and the extraction of text and images. They also support features like form handling, digital signatures, and compatibility across different platforms. Designed for optimal performance, these libraries facilitate efficient PDF processing.
In this article, we will compare two C# PDF libraries: IronPDF and ComPDFKit. This comparison will cover features, functionality, code examples, and licensing. By examining these aspects, you can determine which library best suits your PDF-related projects.
ComPDFKit PDF SDK is a robust C# PDF SDK that allows developers to integrate comprehensive PDF functionalities into their applications. This library supports a wide range of PDF functions necessary for handling PDF documents programmatically. It is designed for use in various environments, including web, desktop, and mobile platforms, making it a versatile tool for developers working on cross-platform projects. It has multiple functions in the example solution. You can select any related ComPDFKit PDF SDK function that you want to try.
ComPDFKit provides a comprehensive set of APIs that streamline the integration of these features into various applications. Its extensive documentation and support make it an excellent choice for developers looking to incorporate advanced PDF functionalities into their projects
IronPDF is a versatile PDF library for .NET that allows developers to create, edit, and manage PDF documents using C#. It provides comprehensive PDF functions. It is designed to simplify PDF generation by rendering PDFs from HTML, CSS, JavaScript, and various image formats. This makes it an ideal tool for developers looking to integrate robust PDF functionality into their .NET applications.
Before we delve into coding examples, let’s create a new Visual Studio project. Here’s a step-by-step guide to setting up a C# console application in Visual Studio.
Visual Studio is the best IDE for C# projects. If you haven't downloaded and installed it yet, download it from this link and install it.
After installing Visual Studio, open it. If you have Visual Studio Community, you can either sign in or continue without signing in.
Integrating IronPDF into your project can be done through various methods, each providing a seamless setup experience.
Alternatively, you can use the NuGet Package Manager Console. Open the console by navigating to Tools > NuGet Package Manager > Package Manager Console in Visual Studio. Once the console is open, execute the command:
Install-Package IronPdf
Install-Package IronPdf
'INSTANT VB TODO TASK: The following line uses invalid syntax:
'Install-Package IronPdf
This approach provides a quick way to install the library using a simple command line.
By following any of these methods, you can efficiently integrate IronPDF into your .NET project.
There are two main methods to add ComPDFKit to your project: using the NuGet Package Manager or a local package.
Open NuGet Package Manager: In Solution Explorer, right-click on "References" and select "Manage NuGet Packages."
Download Package: Obtain the ComPDFKit.NetFramework.nupkg file from the official ComPDFKit website.
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<add key="ComPDFKitSource" value="path\to\directoryContainingNupkg" />
</packageSources>
</configuration>
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<add key="ComPDFKitSource" value="path\to\directoryContainingNupkg" />
</packageSources>
</configuration>
IRON VB CONVERTER ERROR developers@ironsoftware.com
Obtain License: Contact the ComPDFKit team to get a trial or full license.
bool LicenseVerify()
{
if (!CPDFSDKVerifier.LoadNativeLibrary())
return false;
LicenseErrorCode verifyResult = CPDFSDKVerifier.LicenseVerify("input your license here");
return (verifyResult == LicenseErrorCode.E_LICENSE_SUCCESS);
}
bool LicenseVerify()
{
if (!CPDFSDKVerifier.LoadNativeLibrary())
return false;
LicenseErrorCode verifyResult = CPDFSDKVerifier.LicenseVerify("input your license here");
return (verifyResult == LicenseErrorCode.E_LICENSE_SUCCESS);
}
IRON VB CONVERTER ERROR developers@ironsoftware.com
Add this method to your main application file to verify the license.
By following these steps, you can successfully integrate ComPDFKit into your C# project.
Converting HTML pages to PDF is a common requirement in many applications, such as generating reports, invoices, or documentation dynamically from web content. Both IronPDF and ComPDFKit offer robust solutions for this task, but their approaches and capabilities differ significantly.
The process typically starts with capturing the HTML content, which can be static or dynamically generated. The captured HTML is then processed to apply any associated stylesheets (CSS) and scripts (JavaScript), which ensures that the final PDF mirrors the original web page's appearance and behavior.
IronPDF is a versatile library for converting HTML to PDF in C#. It uses a Chrome-based rendering engine to ensure high-quality output. This process involves rendering HTML, CSS, and JavaScript content accurately into PDF format. Here’s a basic example of how to convert an HTML string to a PDF file using IronPDF:
using IronPdf;
using System;
class Program
{
static void Main()
{
// Define your HTML string
string htmlString = @"
<h1>Hello, IronPDF!</h1>
<p>This is a simple PDF created from an HTML string.</p>";
var renderer = new ChromePdfRenderer();
// Convert the HTML string to a PDF document
PdfDocument pdf = renderer.RenderHtmlAsPdf(htmlString);
// Save the PDF document to a file
string outputPath = "sample.pdf";
pdf.SaveAs(outputPath);
Console.WriteLine($"PDF created successfully and saved to {outputPath}");
}
}
using IronPdf;
using System;
class Program
{
static void Main()
{
// Define your HTML string
string htmlString = @"
<h1>Hello, IronPDF!</h1>
<p>This is a simple PDF created from an HTML string.</p>";
var renderer = new ChromePdfRenderer();
// Convert the HTML string to a PDF document
PdfDocument pdf = renderer.RenderHtmlAsPdf(htmlString);
// Save the PDF document to a file
string outputPath = "sample.pdf";
pdf.SaveAs(outputPath);
Console.WriteLine($"PDF created successfully and saved to {outputPath}");
}
}
IRON VB CONVERTER ERROR developers@ironsoftware.com
Similarly, you can create PDFs from the HTML file. It is very helpful because sometimes HTML strings are too big and you need to add CSS with it. IronPDF helps by providing a method to directly convert HTML files along with their CSS and JS files to PDF documents.
using IronPdf;
using System;
class Program
{
static void Main()
{
var renderer = new ChromePdfRenderer();
// Convert the HTML string to a PDF document
PdfDocument pdf = renderer.RenderHtmlFileAsPdf("index.html");
// Save the PDF document to a file
string outputPath = "HTML File.pdf";
pdf.SaveAs(outputPath);
Console.WriteLine($"PDF created successfully and saved to {outputPath}");
}
}
using IronPdf;
using System;
class Program
{
static void Main()
{
var renderer = new ChromePdfRenderer();
// Convert the HTML string to a PDF document
PdfDocument pdf = renderer.RenderHtmlFileAsPdf("index.html");
// Save the PDF document to a file
string outputPath = "HTML File.pdf";
pdf.SaveAs(outputPath);
Console.WriteLine($"PDF created successfully and saved to {outputPath}");
}
}
IRON VB CONVERTER ERROR developers@ironsoftware.com
IronPDF also supports URLs to PDF and HTML files to PDF. These features are very useful in software where document management is important. IronPDF provides a wide range of features for PDF creation and manipulation, making it a powerful tool for developers.
ComPDFKit does not directly support HTML to PDF conversion within its C# SDK. Instead, it offers a separate API specifically for this purpose. This API allows you to perform HTML to PDF conversions by making HTTP requests to their service.
To use the ComPDFKit HTML to PDF API, you would typically follow these steps:
Here’s an example of how you might structure such a request in C#:
using System;
using System.Net.Http;
using System.Threading.Tasks;
public class HtmlToPdfExample
{
public static async Task ConvertHtmlToPdfAsync()
{
using (var client = new HttpClient())
{
var content = new StringContent("<h1>Hello World</h1>");
var response = await client.PostAsync("https://api.compdfkit.com/html-to-pdf", content);
var pdfBytes = await response.Content.ReadAsByteArrayAsync();
System.IO.File.WriteAllBytes("output.pdf", pdfBytes);
}
}
}
using System;
using System.Net.Http;
using System.Threading.Tasks;
public class HtmlToPdfExample
{
public static async Task ConvertHtmlToPdfAsync()
{
using (var client = new HttpClient())
{
var content = new StringContent("<h1>Hello World</h1>");
var response = await client.PostAsync("https://api.compdfkit.com/html-to-pdf", content);
var pdfBytes = await response.Content.ReadAsByteArrayAsync();
System.IO.File.WriteAllBytes("output.pdf", pdfBytes);
}
}
}
IRON VB CONVERTER ERROR developers@ironsoftware.com
It's a demonstration only that we can use API like this in the C# program. There is no specific way to use it for C# in the documentation of ComPDFKit.
Watermarking a PDF is an essential practice for many reasons. It helps protect the document's integrity, asserts ownership, and adds a layer of security. Watermarks can be text, logos, or images that appear either in the background or foreground of a document. They deter unauthorized use, copying, and distribution of the content. Additionally, watermarks can convey important information such as the document's status (e.g., "Confidential," "Draft," "Approved") or the identity of the creator
IronPDF provides a straightforward way to add watermarks to PDF documents programmatically. This functionality is integrated into the library, allowing developers to apply watermarks using C# code.
using IronPdf;
using IronPdf.Editing;
License.LicenseKey = "License-Code";
string watermarkHtml = @"
<img style='width: 500px;' src=""C:\Users\Tayyab Ali\Desktop\watermark.png"">
<h1>IronPDF Watermark</h1>";
ChromePdfRenderer renderer = new ChromePdfRenderer();
PdfDocument pdf = renderer.RenderHtmlAsPdf("<h1>It's a PDF with a watermark</h1>");
// Apply watermark with 45 degrees rotation and 70% opacity
pdf.ApplyWatermark(watermarkHtml, rotation: 30, opacity: 50);
pdf.SaveAs("f://Confedential.pdf");
using IronPdf;
using IronPdf.Editing;
License.LicenseKey = "License-Code";
string watermarkHtml = @"
<img style='width: 500px;' src=""C:\Users\Tayyab Ali\Desktop\watermark.png"">
<h1>IronPDF Watermark</h1>";
ChromePdfRenderer renderer = new ChromePdfRenderer();
PdfDocument pdf = renderer.RenderHtmlAsPdf("<h1>It's a PDF with a watermark</h1>");
// Apply watermark with 45 degrees rotation and 70% opacity
pdf.ApplyWatermark(watermarkHtml, rotation: 30, opacity: 50);
pdf.SaveAs("f://Confedential.pdf");
IRON VB CONVERTER ERROR developers@ironsoftware.com
In this example, the ChromePdfRenderer class is used to create a PDF from an HTML string. The ApplyWatermark method is then used to apply a watermark. The watermark consists of an image and a heading, both defined in the watermarkHtml string. The rotation parameter is set to 30 degrees, and the opacity is set to 50%, ensuring that the watermark is visible but not overpowering the main content. The resulting PDF is saved to a specified path.
ComPDFKit provides comprehensive functionality to add watermarks to PDF documents directly within C#. This can be done programmatically by utilizing the ComPDFKit library's methods. Here’s an example of how to add a text watermark using ComPDFKit:
static private bool AddTextWatermark(CPDFDocument document)
{
CPDFWatermark watermark = document.InitWatermark(C_Watermark_Type.WATERMARK_TYPE_TEXT);
watermark.SetText("test");
watermark.SetFontName("Helvetica");
watermark.SetPages("0-3");
byte[] color = { 255, 0, 0 };
watermark.SetTextRGBColor(color);
watermark.SetScale(2);
watermark.SetRotation(0);
watermark.SetOpacity(120);
watermark.SetVertalign(C_Watermark_Vertalign.WATERMARK_VERTALIGN_CENTER);
watermark.SetHorizalign(C_Watermark_Horizalign.WATERMARK_HORIZALIGN_CENTER);
watermark.SetVertOffset(0);
watermark.SetHorizOffset(0);
watermark.SetFront(true);
watermark.SetFullScreen(true);
watermark.SetVerticalSpacing(10);
watermark.SetHorizontalSpacing(10);
watermark.CreateWatermark();
string path = outputPath + "\\AddTextWatermarkTest.pdf";
if (!document.WriteToFilePath(path))
{
return false;
}
Console.WriteLine("Browse the changed file in " + path);
return true;
}
CPDFDocument document = CPDFDocument.InitWithFilePath("SamplePDF.pdf");
if (AddTextWatermark(document))
{
Console.WriteLine("Add text watermark done.");
}
else
{
Console.WriteLine("Add text watermark failed.");
}
static private bool AddTextWatermark(CPDFDocument document)
{
CPDFWatermark watermark = document.InitWatermark(C_Watermark_Type.WATERMARK_TYPE_TEXT);
watermark.SetText("test");
watermark.SetFontName("Helvetica");
watermark.SetPages("0-3");
byte[] color = { 255, 0, 0 };
watermark.SetTextRGBColor(color);
watermark.SetScale(2);
watermark.SetRotation(0);
watermark.SetOpacity(120);
watermark.SetVertalign(C_Watermark_Vertalign.WATERMARK_VERTALIGN_CENTER);
watermark.SetHorizalign(C_Watermark_Horizalign.WATERMARK_HORIZALIGN_CENTER);
watermark.SetVertOffset(0);
watermark.SetHorizOffset(0);
watermark.SetFront(true);
watermark.SetFullScreen(true);
watermark.SetVerticalSpacing(10);
watermark.SetHorizontalSpacing(10);
watermark.CreateWatermark();
string path = outputPath + "\\AddTextWatermarkTest.pdf";
if (!document.WriteToFilePath(path))
{
return false;
}
Console.WriteLine("Browse the changed file in " + path);
return true;
}
CPDFDocument document = CPDFDocument.InitWithFilePath("SamplePDF.pdf");
if (AddTextWatermark(document))
{
Console.WriteLine("Add text watermark done.");
}
else
{
Console.WriteLine("Add text watermark failed.");
}
IRON VB CONVERTER ERROR developers@ironsoftware.com
In this example, the CPDFDocument class is used to open an existing PDF document. The AddTextWatermark method initializes a text watermark using the InitWatermark method. Various properties of the watermark are set, such as text content, font, color, scale, rotation, opacity, alignment, and spacing. The watermark is then created and applied to the specified pages of the PDF document. Finally, the modified PDF is saved to a specified path. Different methods are needed to integrate image watermarks.
PDF/A is a standardized version of PDF designed for long-term digital preservation of electronic documents. Ensuring documents conform to PDF/A guarantees that they can be reliably viewed and reproduced in the future. This section explores how to create PDF/A compliant documents using two popular libraries: IronPDF and ComPDFKit.
IronPDF simplifies the process of converting standard PDF documents to PDF/A-compliant ones. With IronPDF, you can easily load an existing PDF and save it in a PDF/A compliant format.
using IronPdf;
using System;
class Program
{
static void Main()
{
License.LicenseKey = "License-Key";
PdfDocument pdf = PdfDocument.FromFile("Source.pdf");
pdf.SaveAsPdfA("pdfa-compliant.pdf", PdfAVersions.PdfA3);
}
}
using IronPdf;
using System;
class Program
{
static void Main()
{
License.LicenseKey = "License-Key";
PdfDocument pdf = PdfDocument.FromFile("Source.pdf");
pdf.SaveAsPdfA("pdfa-compliant.pdf", PdfAVersions.PdfA3);
}
}
IRON VB CONVERTER ERROR developers@ironsoftware.com
Here’s a brief overview of the process:
Load the PDF: Use PdfDocument.FromFile to load your source PDF file.
This straightforward approach makes IronPDF a convenient choice for handling PDF/A conversions.
ComPDFKit provides a robust solution for converting PDFs to PDF/A format. The process involves initializing a PDF document, defining the output path, and invoking the conversion method.
static public bool CovertToPDFA1a(CPDFDocument document)
{
string convertToPDFA1aPath = outputPath + "\\ConvertToPDFA1aTest.pdf";
if (!document.WritePDFAToFilePath(CPDFType.CPDFTypePDFA1a, convertToPDFA1aPath))
{
return false;
}
Console.WriteLine("Browse the changed file in " + convertToPDFA1aPath);
return true;
}
CPDFDocument document = CPDFDocument.InitWithFilePath("CommonFivePage.pdf");
if (!Directory.Exists(outputPath))
{
Directory.CreateDirectory(outputPath);
}
if (CovertToPDFA1a(document))
{
Console.WriteLine("Convert to PDF/A-1a done.");
}
else
{
Console.WriteLine("Convert to PDF/A-1a failed.");
}
static public bool CovertToPDFA1a(CPDFDocument document)
{
string convertToPDFA1aPath = outputPath + "\\ConvertToPDFA1aTest.pdf";
if (!document.WritePDFAToFilePath(CPDFType.CPDFTypePDFA1a, convertToPDFA1aPath))
{
return false;
}
Console.WriteLine("Browse the changed file in " + convertToPDFA1aPath);
return true;
}
CPDFDocument document = CPDFDocument.InitWithFilePath("CommonFivePage.pdf");
if (!Directory.Exists(outputPath))
{
Directory.CreateDirectory(outputPath);
}
if (CovertToPDFA1a(document))
{
Console.WriteLine("Convert to PDF/A-1a done.");
}
else
{
Console.WriteLine("Convert to PDF/A-1a failed.");
}
IRON VB CONVERTER ERROR developers@ironsoftware.com
Here’s a summary of the steps:
Digital signatures are essential for verifying the authenticity and integrity of documents. This section demonstrates how to add digital signatures to PDFs using IronPDF and ComPDFKit.
IronPDF provides a simple and effective way to apply digital signatures to PDF documents.
using IronPdf;
using IronPdf.Signing;
class Program
{
static void Main(string[] args)
{
var simpleSignature = new IronPdf.Signing.PdfSignature("MyCert.p12", "newpassword");
simpleSignature.SignPdfFile("sample.pdf");
}
}
using IronPdf;
using IronPdf.Signing;
class Program
{
static void Main(string[] args)
{
var simpleSignature = new IronPdf.Signing.PdfSignature("MyCert.p12", "newpassword");
simpleSignature.SignPdfFile("sample.pdf");
}
}
IRON VB CONVERTER ERROR developers@ironsoftware.com
The process involves:
Create a Signature: Initialize a PdfSignature object with the certificate file and password.
This method ensures that your PDF documents are securely signed, enhancing their credibility and security.
ComPDFKit offers a comprehensive solution for creating digital signatures with extensive customization options.
private static void CreateDigitalSignature(CPDFDocument document, string certificatePath, string password)
{
Console.WriteLine("--------------------");
Console.WriteLine("Create digital signature.");
CPDFSignatureCertificate certificate = CPDFPKCS12CertHelper.GetCertificateWithPKCS12Path("Certificate.pfx", "ComPDFKit");
CPDFPage page = document.PageAtIndex(0);
CPDFSignatureWidget signatureField = page.CreateWidget(C_WIDGET_TYPE.WIDGET_SIGNATUREFIELDS) as CPDFSignatureWidget;
signatureField.SetRect(new CRect(28, 420, 150, 370));
signatureField.SetWidgetBorderRGBColor(new byte[] { 0, 0, 0 });
signatureField.SetWidgetBgRGBColor(new byte[] { 150, 180, 210 });
signatureField.UpdateAp();
string name = GetGrantorFromDictionary(certificate.SubjectDict) + "\n";
string date = DateTime.Now.ToString("yyyy.MM.dd HH:mm:ss");
string reason = "I am the owner of the document.";
string location = certificate.SubjectDict["C"];
string DN = certificate.Subject;
CPDFSignatureConfig signatureConfig = new CPDFSignatureConfig
{
Text = GetGrantorFromDictionary(certificate.SubjectDict),
Content =
"Name: " + name + "\n" +
"Date: " + date + "\n" +
"Reason: " + reason + " \n" +
"Location: " + location + "\n" +
"DN: " + DN + "\n",
IsContentAlignLeft = false,
IsDrawLogo = true,
LogoBitmap = new Bitmap("Logo.png"),
TextColor = new float[] { 0, 0, 0 },
ContentColor = new float[] { 0, 0, 0 }
};
string filePath = outputPath + "\\" + document.FileName + "_Signed.pdf";
signatureField.UpdataApWithSignature(signatureConfig);
if (document.WriteSignatureToFilePath(signatureField,
filePath,
certificatePath, password,
location,
reason, CPDFSignaturePermissions.CPDFSignaturePermissionsNone))
{
Console.WriteLine("File saved in " + filePath);
Console.WriteLine("Create digital signature done.");
}
else
{
Console.WriteLine("Create digital signature failed.");
}
Console.WriteLine("--------------------");
}
private static void CreateDigitalSignature(CPDFDocument document, string certificatePath, string password)
{
Console.WriteLine("--------------------");
Console.WriteLine("Create digital signature.");
CPDFSignatureCertificate certificate = CPDFPKCS12CertHelper.GetCertificateWithPKCS12Path("Certificate.pfx", "ComPDFKit");
CPDFPage page = document.PageAtIndex(0);
CPDFSignatureWidget signatureField = page.CreateWidget(C_WIDGET_TYPE.WIDGET_SIGNATUREFIELDS) as CPDFSignatureWidget;
signatureField.SetRect(new CRect(28, 420, 150, 370));
signatureField.SetWidgetBorderRGBColor(new byte[] { 0, 0, 0 });
signatureField.SetWidgetBgRGBColor(new byte[] { 150, 180, 210 });
signatureField.UpdateAp();
string name = GetGrantorFromDictionary(certificate.SubjectDict) + "\n";
string date = DateTime.Now.ToString("yyyy.MM.dd HH:mm:ss");
string reason = "I am the owner of the document.";
string location = certificate.SubjectDict["C"];
string DN = certificate.Subject;
CPDFSignatureConfig signatureConfig = new CPDFSignatureConfig
{
Text = GetGrantorFromDictionary(certificate.SubjectDict),
Content =
"Name: " + name + "\n" +
"Date: " + date + "\n" +
"Reason: " + reason + " \n" +
"Location: " + location + "\n" +
"DN: " + DN + "\n",
IsContentAlignLeft = false,
IsDrawLogo = true,
LogoBitmap = new Bitmap("Logo.png"),
TextColor = new float[] { 0, 0, 0 },
ContentColor = new float[] { 0, 0, 0 }
};
string filePath = outputPath + "\\" + document.FileName + "_Signed.pdf";
signatureField.UpdataApWithSignature(signatureConfig);
if (document.WriteSignatureToFilePath(signatureField,
filePath,
certificatePath, password,
location,
reason, CPDFSignaturePermissions.CPDFSignaturePermissionsNone))
{
Console.WriteLine("File saved in " + filePath);
Console.WriteLine("Create digital signature done.");
}
else
{
Console.WriteLine("Create digital signature failed.");
}
Console.WriteLine("--------------------");
}
IRON VB CONVERTER ERROR developers@ironsoftware.com
The steps include:
Extracting text from PDF documents is crucial for various data processing and analysis tasks. This section explains how to extract text from PDFs using IronPDF and ComPDFKit.
IronPDF offers a straightforward method for extracting text from PDF documents.
using IronPdf;
using System.IO;
PdfDocument pdf = PdfDocument.FromFile("PDF File With Text.pdf");
string text = pdf.ExtractAllText();
File.WriteAllText("PDF Text.txt", text);
using IronPdf;
using System.IO;
PdfDocument pdf = PdfDocument.FromFile("PDF File With Text.pdf");
string text = pdf.ExtractAllText();
File.WriteAllText("PDF Text.txt", text);
IRON VB CONVERTER ERROR developers@ironsoftware.com
The process involves:
Load the PDF: Use PdfDocument.FromFile to load the PDF file.
Extract Text: Call ExtractAllText to retrieve all text content from the PDF.
This method provides an easy and efficient way to extract and save text from PDF documents.
ComPDFKit provides a flexible solution for text extraction from PDF documents.
static private bool PDFToText(CPDFDocument document)
{
string path = outputPath + "//PDFToText.txt";
if (!document.PdfToText("1-" + document.PageCount.ToString(), path))//Page ranges are counted from 1
{
return false;
}
Console.WriteLine("Browse the generated file in " + path);
return true;
}
static void Main(string[] args)
{
#region Perparation work
Console.WriteLine("Running PDFPage test sample…\r\n");
SDKLicenseHelper.LicenseVerify();
CPDFDocument document = CPDFDocument.InitWithFilePath("CommonFivePage.pdf");
if (!Directory.Exists(outputPath))
{
Directory.CreateDirectory(outputPath);
}
#endregion
if (PDFToText(document))
{
Console.WriteLine("PDF to text done.");
}
else
{
Console.WriteLine("PDF to text failed.");
}
Console.WriteLine("--------------------");
Console.WriteLine("Done!");
Console.WriteLine("--------------------");
Console.ReadLine();
}
static private bool PDFToText(CPDFDocument document)
{
string path = outputPath + "//PDFToText.txt";
if (!document.PdfToText("1-" + document.PageCount.ToString(), path))//Page ranges are counted from 1
{
return false;
}
Console.WriteLine("Browse the generated file in " + path);
return true;
}
static void Main(string[] args)
{
#region Perparation work
Console.WriteLine("Running PDFPage test sample…\r\n");
SDKLicenseHelper.LicenseVerify();
CPDFDocument document = CPDFDocument.InitWithFilePath("CommonFivePage.pdf");
if (!Directory.Exists(outputPath))
{
Directory.CreateDirectory(outputPath);
}
#endregion
if (PDFToText(document))
{
Console.WriteLine("PDF to text done.");
}
else
{
Console.WriteLine("PDF to text failed.");
}
Console.WriteLine("--------------------");
Console.WriteLine("Done!");
Console.WriteLine("--------------------");
Console.ReadLine();
}
IRON VB CONVERTER ERROR developers@ironsoftware.com
The steps are:
The licensing models for IronPDF and ComPDFKit differ in their approach and usage terms. Understanding these differences can help you choose the right tool for your project's needs and budget.
IronPDF operates under a commercial licensing model, meaning that for commercial or business-related applications, purchasing a license is generally required. This model offers flexibility, including options like royalty-free distribution. This allows developers to incorporate the library into their projects without facing additional costs during runtime.
IronPDF offers perpetual licenses. Perpetual licenses require a one-time payment for lifetime use, with optional fees for updates and technical support beyond the initial period. This commercial model ensures that enterprises receive dedicated support, comprehensive documentation, and access to advanced features necessary for professional PDF generation and manipulation.
ComPDFKit employs a flexible licensing model that caters to different business needs. It offers both perpetual and subscription licenses. A perpetual license involves a one-time payment that grants lifetime access to the SDK, with optional fees for updates and extended support. Subscription licenses require regular payments (monthly or annually) and include ongoing access to updates and support.
When deciding between IronPDF and ComPDFKit, consider the specific requirements of your project, such as the need for dedicated support, budget constraints, and the scale of deployment. IronPDF's commercial model is more suitable for businesses looking for robust support and advanced features.
IronPDF offers comprehensive documentation and robust support options for its users. The documentation is extensive and detailed, providing clear guidance on installation, basic usage, advanced features, and troubleshooting. The official documentation is available on Read the Docs, which includes a QuickStart guide, detailed API references, and numerous code examples to help developers get started and effectively use IronPDF's features.
IronPDF also maintains an active troubleshooting guide and technical support site through its blog and example section, where users can find solutions to common issues, such as rendering delays and deployment challenges. The support site includes a collection of articles addressing frequently asked questions and specific technical issues.
For direct support, IronPDF offers a responsive customer service team that can be contacted for more complex issues or personalized assistance. This combination of extensive documentation and strong support infrastructure makes IronPDF a reliable choice for developers looking to integrate PDF functionalities into their applications.
ComPDFKit also provides thorough documentation and support resources for its users. It covers various aspects of using the SDK, from basic setup to advanced functionalities like watermarking and digital signatures. For support, ComPDFKit provides technical assistance through its customer service channels. The support team is available to help resolve technical issues, answer questions, and provide guidance on using the SDK effectively.
While both IronPDF and ComPDFKit offer strong documentation and support, IronPDF has an edge with its more extensive troubleshooting guides and a highly responsive support team. This makes it particularly advantageous for developers who might encounter complex technical challenges and need reliable assistance.
The comparison between IronPDF and ComPDFKit highlights the strengths and considerations for developers seeking robust C# libraries for PDF generation and manipulation.
ComPDFKit is a comprehensive PDF SDK that supports a wide range of functionalities necessary for handling PDF documents programmatically. It excels in PDF annotations and has extensive editing capabilities. Its features like format conversion and security options add significant value for developers.
IronPDF, on the other hand, is known for its powerful and user-friendly API. It simplifies PDF generation by rendering PDFs from HTML, CSS, and JavaScript. IronPDF excels in HTML to PDF conversion, offering seamless integration with .NET applications. The library provides extensive editing capabilities, including adding headers, footers, watermarks, and digital signatures.
IronPDF's security features ensure that sensitive information within PDF documents is well-protected. Its support for multiple .NET platforms and optimized performance for high workloads make it an ideal choice for enterprise-level applications. The commercial licensing model of IronPDF ensures dedicated support, comprehensive documentation, and access to advanced features, making it particularly suitable for professional-grade projects.
IronPDF stands out as a strong option compared to ComPDFKit for developers looking for a comprehensive and feature-rich PDF library. Its advanced functionalities, user-friendly API, and robust support infrastructure make it a preferred solution for enterprises and projects with diverse and demanding PDF-related requirements. IronPDF's extensive capabilities and dedicated support provide a significant edge, ensuring reliable and efficient PDF generation and manipulation for professional applications.
In summary, both IronPDF and ComPDFKit are powerful tools for PDF processing in C#. However, IronPDF's extensive feature set, optimized performance, and superior support make it the preferred choice for developers aiming for professional and enterprise-level applications.
IronPDF provides a free trial license for users to try out the library and its capabilities. IronPDF license starts from $749. Additionally, Iron Software bundles nine libraries for the cost of two, which includes IronXL and IronOCR along with IronPDF.
9 .NET API products for your office documents