Overview of HiQPdf Next for .NET

HiQPdf Next for .NET is a library that can be integrated into any type of .NET application to create and process PDF documents.

You can create PDF documents, convert HTML, Word, Excel, RTF and Markdown documents to PDF, extract text and images from existing PDF documents, perform text search operations on PDF documents and convert PDF pages to images.

Compatibility

The library targets .NET Standard 2.0, so it can be used in any .NET Core or .NET Framework application compatible with this standard. The library can run on Windows and Linux 64 bit operating systems.

The software is compatible with Azure App Service and Azure Functions from Microsoft on both Windows and Linux.

It is also compatible with Docker containers running on Windows and Linux with example Dockerfiles available in dedicated sections of the documentation.

The documentation provides additional details about compatibility and installation instructions for each supported platform.

Library Components

The library has a modular structure, with separate NuGet packages for each major component to prevent unnecessary files from being included in your applications. All components share the same HiQPdf.Next namespace and can be used together within the same project.

Core Component

The Core component provides the API for programmatically creating, manipulating and protecting PDF documents.

To use the Core component in applications targeting Windows, reference the HiQPdf.Next.Core.Windows NuGet package.

For applications targeting Linux, reference the HiQPdf.Next.Core.Linux NuGet package.

For applications targeting multiple platforms reference the HiQPdf.Next.Core NuGet metapackage, which references the platform specific Core packages for Windows and Linux.

You can find a detailed description of this component in the Core Component Overview documentation section.

HTML to PDF Converter Component

The HTML to PDF Converter component uses a Chromium based rendering engine capable of processing modern HTML, CSS and JavaScript content in compliance with the latest standards.

The HTML to PDF Converter combines the powerful print friendly PDF format with the flexibility of HTML providing a modern tool for creating well formatted and easily maintainable PDF reports and documents.

The HTML to PDF Converter component is delivered as separate NuGet packages for Windows and Linux. HTML to PDF functionality is also used internally by other components of the library to provide advanced features such as adding HTML headers, footers and templates.

To use the HTML to PDF Converter component in applications targeting Windows, reference the HiQPdf.Next.HtmlToPdf.Windows NuGet package.

For applications targeting Linux, reference the HiQPdf.Next.HtmlToPdf.Linux NuGet package.

For applications targeting multiple platforms reference the HiQPdf.Next.HtmlToPdf NuGet metapackage, which references the platform specific packages for Windows and Linux.

The HTML to PDF Converter packages reference the corresponding Core packages, so there is no need to explicitly reference the Core packages when referencing the HTML to PDF Converter package.

You can find a detailed description of this component in the HTML to PDF Converter documentation section.

Word to PDF Component

The Word to PDF Converter component allows you to convert DOCX Word documents to PDF.

The Word to PDF Converter component is delivered as separate NuGet packages for Windows and Linux.

To use the Word to PDF Converter component in applications targeting Windows, reference the HiQPdf.Next.WordToPdf.Windows NuGet package.

For applications targeting Linux, reference the HiQPdf.Next.WordToPdf.Linux NuGet package.

For applications targeting multiple platforms reference the HiQPdf.Next.WordToPdf NuGet metapackage, which references the platform specific packages for Windows and Linux.

The Word to PDF Converter packages reference the corresponding Core packages, so there is no need to explicitly reference the Core packages when referencing the Word to PDF Converter package.

You can find a detailed description of this component in the Convert Word DOCX to PDF documentation section.

Excel to PDF Component

The Excel to PDF Converter component allows you to convert XLSX Excel documents to PDF.

The Excel to PDF Converter component is delivered as separate NuGet packages for Windows and Linux.

To use the Excel to PDF Converter component in applications targeting Windows, reference the HiQPdf.Next.ExcelToPdf.Windows NuGet package.

For applications targeting Linux, reference the HiQPdf.Next.ExcelToPdf.Linux NuGet package.

For applications targeting multiple platforms reference the HiQPdf.Next.ExcelToPdf NuGet metapackage, which references the platform specific packages for Windows and Linux.

The Excel to PDF Converter packages reference the corresponding Core packages, so there is no need to explicitly reference the Core packages when referencing the Excel to PDF Converter package.

You can find a detailed description of this component in the Convert Excel XLSX to PDF documentation section.

RTF to PDF Component

The RTF to PDF Converter component allows you to convert RTF documents to PDF.

The RTF to PDF Converter component is delivered as separate NuGet packages for Windows and Linux.

To use the RTF to PDF Converter component in applications targeting Windows, reference the HiQPdf.Next.RtfToPdf.Windows NuGet package.

For applications targeting Linux, reference the HiQPdf.Next.RtfToPdf.Linux NuGet package.

For applications targeting multiple platforms reference the HiQPdf.Next.RtfToPdf NuGet metapackage, which references the platform specific packages for Windows and Linux.

The RTF to PDF Converter packages reference the corresponding Core packages, so there is no need to explicitly reference the Core packages when referencing the RTF to PDF Converter package.

You can find a detailed description of this component in the Convert RTF to PDF documentation section.

Markdown to PDF Component

The Markdown to PDF Converter component allows you to convert Markdown documents to PDF.

The Markdown to PDF Converter component is delivered as separate NuGet packages for Windows and Linux.

To use the Markdown to PDF Converter component in applications targeting Windows, reference the HiQPdf.Next.MarkdownToPdf.Windows NuGet package.

For applications targeting Linux, reference the HiQPdf.Next.MarkdownToPdf.Linux NuGet package.

For applications targeting multiple platforms reference the HiQPdf.Next.MarkdownToPdf NuGet metapackage, which references the platform specific packages for Windows and Linux.

The Markdown to PDF Converter packages reference the corresponding Core packages, so there is no need to explicitly reference the Core packages when referencing the Markdown to PDF Converter package.

You can find a detailed description of this component in the Convert Markdown to PDF documentation section.

PDF Processor Component

The PDF Processor component provides functionality for processing existing PDF documents. It includes the PDF to Text and PDF Text Search functionalities as well as the PDF to Image and PDF Image Extraction functionalities.

To use the PDF Processor component in applications targeting Windows, reference the HiQPdf.Next.PdfProcessor.Windows NuGet package.

For applications targeting Linux, reference the HiQPdf.Next.PdfProcessor.Linux NuGet package.

For applications targeting multiple platforms reference the HiQPdf.Next.PdfProcessor NuGet metapackage, which references the platform specific packages for Windows and Linux.

The PDF Processor packages reference the corresponding Core packages, so there is no need to explicitly reference the Core packages when referencing the PDF Processor package.

PDF to Text Component

The PDF to Text component allows you to extract text from existing PDF documents and to search for text within them. It is part of the PDF Processor component and is delivered through the same NuGet package, as described in the PDF Processor section.

You can find a detailed description of this component in the Convert PDF to Text and Search for Text in PDF documentation sections.

PDF to Image Component

The PDF to Image component allows you to convert PDF pages to PNG images. It is part of the PDF Processor component and is delivered through the same NuGet package, as described in the PDF Processor section.

You can find a detailed description of this component in the Convert PDF Pages to Images documentation section.

PDF Images Extractor Component

The PDF Images Extractor component allows you to extract the images embedded in existing PDF documents. It is part of the PDF Processor component and is delivered through the same NuGet package, as described in the PDF Processor section.

You can find a detailed description of this component in the Extract Images from PDF documentation sections.

Meta Packages for All Components

Besides the component specific packages, the library also provides metapackages that reference the packages for all components.

To use all the components in applications targeting Windows, reference the HiQPdf.Next.Windows NuGet package.

For applications targeting Linux, reference the HiQPdf.Next.Linux NuGet package.

For applications targeting multiple platforms reference the HiQPdf.Next NuGet package, which references the platform specific packages for Windows and Linux.

HiQPdf.Next Namespace

All components of the library share the same HiQPdf.Next namespace and can be used together in the same application.

At the top of your C# source file add the using HiQPdf.Next; statement to make the HiQPdf Next API available in your .NET application.

C#
// Include the HiQPdf namespace at the top of your C# file
using HiQPdf.Next;

Sample C# Code to Convert an HTML String to PDF

You can use the C# code below to convert an HTML string to a PDF file, first obtaining the generated PDF in a memory buffer.

C#
// Create the HTML to PDF converter object
HtmlToPdf converter = new HtmlToPdf();

// Convert the HTML code to memory
byte[] htmlToPdfData = converter.ConvertHtmlToMemory("<b>Hello World</b> from HiQPdf!", null);

// Save the PDF data to a file
System.IO.File.WriteAllBytes("html_to_memory.pdf", htmlToPdfData);

Sample C# Code to Convert a URL to PDF

You can use the C# code below to convert a web page from a given URL to a PDF file, first obtaining the generated PDF in a memory buffer. To convert a local file, prefix the full file path with file:// to form a valid URL.

C#
// Create the HTML to PDF converter object
HtmlToPdf converter = new HtmlToPdf();

// Convert the HTML page from URL to memory
string urlToConvert = "http://www.hiqpdf.com";
byte[] urlToPdfData = converter.ConvertUrlToMemory(urlToConvert);

// Save the PDF data to a file
System.IO.File.WriteAllBytes("url_to_memory.pdf", urlToPdfData);

Getting Started on Windows and Linux Platforms

The documentation provides detailed instructions for getting started with HiQPdf Next for .NET on Windows and Linux, as well as in environments such as Azure App Service, Azure Functions and Docker containers for both platforms.

See Also