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.
HiQPdf Next for .NET runs natively on 64-bit Windows operating systems. The product runtime is compatible with Windows 10, Windows Server 2016 and later versions of the Windows 64-bit OS.
The .NET library targets .NET Standard 2.0 and therefore can be used in any .NET Core or .NET Framework application that supports this standard.
The product can run on Windows without installing anything and without any prior configuration of the operating system. The steps required to use the library in your application are detailed below.
The software is fully compatible with Azure App Service and Azure Functions on Windows. Installation instructions for these platforms are provided in separate documentation sections.
The library structure is modular, with separate NuGet packages for major components to prevent unnecessary files from being included in your applications. You can choose to reference a single package to install all the components of the library or you can install only the components you need.
To install all components of the HiQPdf Next library, add a reference to the HiQPdf.Next.Windows metapackage from NuGet.
The metapackage references the packages for all library components, including the HTML to PDF converter, Word to PDF, Excel to PDF, RTF to PDF and Markdown to PDF conversion components, as well as the PDF text extraction and text search functionalities, the PDF to Image converter and the PDF Images Extractor. This can bring many files into your project and you may prefer to use only specific components.
To install only specific components of the HiQPdf Next library, you can add references to the corresponding NuGet packages from NuGet.
To use only the Core component, you can install the HiQPdf.Next.Core.Windows NuGet package.
To use only the HTML to PDF Converter component, you can install the HiQPdf.Next.HtmlToPdf.Windows NuGet package.
To use the Word to PDF, Excel to PDF, RTF to PDF or Markdown to PDF conversion components, install the corresponding package: HiQPdf.Next.WordToPdf.Windows, HiQPdf.Next.ExcelToPdf.Windows, HiQPdf.Next.RtfToPdf.Windows or HiQPdf.Next.MarkdownToPdf.Windows .
To use the PDF Processor components PDF to Text, PDF Text Search, PDF to Image and PDF Images Extraction, you only need to install the HiQPdf.Next.PdfProcessor.Windows NuGet package.
Any combination of these packages can be installed in your project, depending on which components you want to use.
All components of the library share the same HiQPdf.Next namespace and can be used together in the same application.
After the NuGet package has been installed, add the using HiQPdf.Next; directive at the top of your C# source file to include the HiQPdf.Next namespace and make the library API available.
// add this using statement at the top of your C# file
using HiQPdf.Next;You are now ready to use the HiQPdf Next library API in your .NET application targeting the Windows operating system.
With the code below, you can convert an HTML string to a PDF document in a memory buffer and then save the data from the buffer to a file.
// 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);With the code below, you can convert a URL to a PDF document in a memory buffer and then save the data from the buffer to a file. The URL can also be a local file path prefixed with the file:// URI scheme.
// 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);With the code below, you can convert an HTML string to a PDF document in a memory buffer in your ASP.NET Core applications, and then send it to the browser for download.
// 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);
FileResult fileResult = new FileContentResult(htmlToPdfData, "application/pdf");
fileResult.FileDownloadName = "html_to_pdf.pdf";
return fileResult;With the code below, you can convert a URL to a PDF document in a memory buffer in your ASP.NET Core applications, and then send it to the browser for download. The URL can also be a local file path prefixed with the file:// URI scheme.
// Create the HTML to PDF converter object
HtmlToPdf converter = new HtmlToPdf();
// Convert the HTML code to memory
string urlToConvert = "http://www.hiqpdf.com";
byte[] urlToPdfData = converter.ConvertUrlToMemory(urlToConvert);
FileResult fileResult = new FileContentResult(urlToPdfData, "application/pdf");
fileResult.FileDownloadName = "url_to_pdf.pdf";
return fileResult;Everything should now be configured, and you can run your application. Alternatively, you can follow the same instructions from this document to build and publish our ASP.NET demo application on Windows.