The new HiQPdf Client-Server Solution allows you to use the same features from regular HiQPdf library in applications on any platform
that supports .NET Core or .NET Standard 2.0 and above.
You can deploy your applications using this solution on Windows, Linux and MacOS operating systems or
on Azure App Service platform. You can use it in UWP and Xamarin applications.
The HiQPdf Client-Server Architecture consists in HiQPdf Server application which can run as a Windows Service or as an Azure Cloud Service
and a client library for .NET Core that can be used in any .NET Core application for any platform which offers support for
.NET Core or .NET Standard 2.0 and above.
You can deploy your .NET Core applications on Windows, Linux and MacOS operating systems
or in Azure App Service for Windows and Linux. You can also use the library in Universal Windows Platform applications or in Xamarin applications
for Android and iOS.
There is also a client library for .NET Framework which can be used in classic .NET applications. The two client libraries have the same API.
The HiQPdf Server is delivered as a ZIP package you can download from downloads page and it contains the server files and the detailed
installation instructions.
The client libraries for .NET Core and for .NET Framework are also delivered as separate ZIP packages you can download. The packages contain the
library binary assemblies, documentation and demo applications with complete C# and VB.NET Code.
Before using the .NET Core client library it is necessary to install the HiQPdf Server. The server can be accessed in client applications with an
IP address and a port number which are assigned when the server is installed.
Same Quality for All Platforms
The PDF documents you can create with this new technology have the same quality you can get with the regular HiQPdf library on all platforms.
You can deploy the same .NET Core application in Azure App Service for Windows or for Linux and the generated PDF documents will be the same
Same Features as the Regular Library for .NET
The client libraries for .NET and .NET Core have an API very similar to the
regular library for .NET. You will able to use the new multi-platform client library with minor code changes
or even without any code changes for some features like HTML to PDF conversion
Advanced Features in Restricted Environments
All the advanced features like Web Fonts rendering in HTML to PDF Converter are fully supported
and made available even to the most restrictive platforms like Azure App Service,
Universal Windows Platform or Xamarin for Android and iOS
Fully Owned and Reusable Server Instance
You install your own server instance once in Azure Cloud or on any Windows Server and you can reuse it in many .NET Core applications
that you can deploy on multiple platforms.
The HiQPdf Server is secure, reliable, configurable, designed for highly concurrent usage. You are not using any third-party online service, you control everything
ASP.NET Core, Web Forms and MVC Samples
The HiQPdf client libraries comes with a suite of ASP.NET Core, ASP.NET Web Forms and MVC samples with complete source code in C# and VB.NET. The main
features of the library are well documented and there is a complete API reference in HTML and in Microsoft Help format. If you need more help you can
contact our support team at any time
Simple and Flexible Licensing for All Platforms
The same license works both with the regular library for .NET and with the client libraries for .NET and .NET Core.
There are no additional run time or deployment costs charged for using our software component in your applications,
the license never expires and includes the software upgrades
The HiQPdf Multi-Platform Solution delivers the same power and quality to your .NET Core applications on many platforms, including
the most restrictive ones.
The solution consists in HiQPdf Server application which can run as an Azure Cloud Service or as a Windows Service
and a client library for .NET Core that can be used in any .NET Core application on any platform which offers support for
.NET Core or .NET Standard 2.0 and above.
You can deploy your .NET Core applications on Windows, Linux and MacOS operating systems
or in more restrictive environments like Azure App Service for Windows and Linux. You can also use the library in Universal Windows Platform applications
or in Xamarin applications for Android and iOS.
Detailed Features
Below you can find a detailed description of the most important features of the HiQPdf HTML to PDF Converter, each feature
having also a corresponding sample in the online demo.
- Convert HTML Documents to PDF, to Image or to SVG -
Quickly and accurately convert HTML documents with CSS3, JavaScript, SVG, Canvas and Web Fonts (WOFF) to PDF, SVG or Image.
Multiple HTML documents can be laid out in a PDF preserving transparencies.
The HTML to Image converter can produce transparent images
- Convert Only a Selected Region of a HTML Document to PDF -
The HiQPdf HTML to PDF converter can be configured to convert only a selected region of the HTML document to PDF.
Other HTML to PDF converters on the market can only hide the content around the region to be converted, but the HiQPdf converter
will precisely convert the selected HTML region as it would be a standalone document.
- Convert Multiple HTML Documents into the Same PDF document -
A HTML document can be laid out at any position in PDF using a PdfHtml object and multiple objects of this type can be overlapped in multiple
layers which can create a very interesting effect when the HTML documents have transparent background.
- Automatic, Manual or WaitTime HTML Conversion Triggering -
By default the conversion is automatically triggered when the HTML is loaded. Because JavaScript can continue execution after load it is
possible to manully trigger conversion with a call from JavaScript or to wait a constant interval before triggering conversion.
- Automatically Generated Outlines and Links -
The HTML to PDF converter engine can automatically generate outlines for the HTML elements selected by a list of CSS selectors.
The HTTP and internal links from HTML are automatically converted to to HTTP and internal links in PDF
- Control PDF page breaks with page-break CSS attributes in HTML -
Use page-break-before:always in HTML to force a page break right before the element, page-break-after:always to force a page break right after
the element and page-break-inside:avoid to avoid cutting off the element between PDF pages if possible
- Repeat HTML Table Header and Footer on Each PDF Page -
When the 'display: table-header-group' is present in the HTML table thead tag style the thead content will be automatically repeated on all the PDF pages.
When the 'display: table-footer-group' is present in the HTML table tfoot tag style the tfoot content will be automatically repeated on all the PDF pages.
- Retrieve Detailed Info About the Laid Out HTML Elements -
The HTML to PDF converter can retrieve detailed information about the HTML elements selected by a list of CSS selectors.
You can find the HTML element bounds in PDF, HTML element ID, HTML code, CSS class, the HTML tag and the text if available
- HTTP Authentication, HTTP Headers, HTTP Cookies and Proxies -
The HTML converters can resolve NTLM authentication by setting the username and password, can transmit custom HTTP headers and cookies
to the web server when accessing a web page and can get through proxies when the proxy parameters are set
- Use HTTP GET or POST Requests to Access the HTML to Convert -
When converting a HTML document from a given URL, the HTML to PDF converter will access the document using the GET HTTP method by default,
but it can be configured to access the web page to convert using the POST HTTP method and to transmit a set of fields to the web server
- Create PDF/A and PDF/X Standards Compliant Documents -
By default the HiQPdf library creates documents compliant to PDF 1.4 standard, but it can be easily configured to create PDF documents compliant
to PDF/A standard for long term archiving and to PDF/X standard to facilitate the graphics exchange
- Encrypt, Password Protect and Digitally Sign PDF Documents -
The HiQPdf library includes a set of security features which allow you to set restrictions on the created PDF documents like forbidding printing
or content copying, password protect the created PDF documents with user and owner passwords and digitally sign the created PDF documents
- Create and Submit Interactive PDF Forms -
The HiQPdf library can create PDF documents with interactive forms and set a submit action for the form
- Add HTML, Text, Image and Graphic Objects to PDF -
The HiQPdf library can layout PDF objects like text, images and graphics in a PDF document in a classic manner at a given position in a PDF page.
It is interesting that the HTML can be treated as a drawable PDF object and can be laid out at any position in PDF
- Create PDF Documents with Outlines, Links and Attachments -
Using HiQPdf library you can create a hierarchy of outlines in the PDF document, you can create internal or URI links in PDF pages and you
can attach files and streams to the generated PDF document
- Load and Edit External PDF Documents -
With the HiQPdf software can not only create new PDF documents but you can also load and edit external PDF documents. The editing is limited to adding
PDF objects on the top of the existing content. It is not possible to change or delete text for example
- Merge PDF Documents -
You can merge multiple PDF documents into a single PDF document
- Extract the Text from PDF Documents -
HiQPdf Library allows you to extract the text from PDF documents to .NET String objects.
When you extract the text you can choose the extraction mode and the range of PDF pages
from where to extract the text.
- Search Text in PDF Documents -
HiQPdf Library allows you to search a text in a PDF document. The search can match the case
or whole word only and you can choose the range of PDF pages where to search the text.
The library returns the positions and the bounds of the text instances in PDF document pages.
- Extract the Images from PDF Documents -
HiQPdf Library allows you to extract the images from PDF documents to memory objects or
to image files in a folder. You can choose the range of PDF pages from where to extract the images.
- Rasterize PDF Pages to Images -
HiQPdf Library allows you to rasterize PDF pages to image objects in memory or to image files in a folder.
You can choose the color space of resulted images, the resolution of the rasterization and the range of
PDF pages to rasterize.
HTML to PDF Converter for .NET - C# Code Sample for ASP.NET Core
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Hosting;
using HiQPdfClient;
namespace HiQPdf_Demo.Controllers
{
public class ConvertHtmlToPdfController : Controller
{
IFormCollection m_formCollection;
IWebHostEnvironment m_hostingEnvironment;
public ConvertHtmlToPdfController(IWebHostEnvironment hostingEnvironment)
{
m_hostingEnvironment = hostingEnvironment;
}
// GET: ConvertHtmlToPdf
public ActionResult Index()
{
return View();
}
[HttpPost]
public ActionResult ConvertToPdf(IFormCollection collection)
{
m_formCollection = collection;
string serverIP = collection["textBoxServerIP"];
uint serverPort = uint.Parse(collection["textBoxServerPort"]);
string serverPassword = collection["textBoxServerPassword"];
// create the HTML to PDF converter
HtmlToPdf htmlToPdfConverter = new HtmlToPdf(serverIP, serverPort);
// use server password if necessary
if (serverPassword.Length > 0)
htmlToPdfConverter.ServerPassword = serverPassword;
// set a demo serial number
htmlToPdfConverter.SerialNumber = "YCgJMTAE-BiwJAhIB-EhlWTlBA-UEBRQFBA-U1FOUVJO-WVlZWQ==";
// set browser width
htmlToPdfConverter.BrowserWidth = int.Parse(collection["textBoxBrowserWidth"]);
// set browser height if specified, otherwise use the default
if (collection["textBoxBrowserHeight"][0].Length > 0)
htmlToPdfConverter.BrowserHeight = int.Parse(collection["textBoxBrowserHeight"]);
// set HTML Load timeout
htmlToPdfConverter.HtmlLoadedTimeout = int.Parse(collection["textBoxLoadHtmlTimeout"]);
// set PDF page size and orientation
htmlToPdfConverter.Document.PageSize = GetSelectedPageSize();
htmlToPdfConverter.Document.PageOrientation = GetSelectedPageOrientation();
// set the PDF standard used by the document
htmlToPdfConverter.Document.PdfStandard = collection["checkBoxPdfA"].Count > 0 ? PdfStandard.PdfA : PdfStandard.Pdf;
// set PDF page margins
htmlToPdfConverter.Document.Margins = new PdfMargins(5);
// set whether to embed the true type font in PDF
htmlToPdfConverter.Document.FontEmbedding = collection["checkBoxFontEmbedding"].Count > 0;
// set triggering mode; for WaitTime mode set the wait time before convert
switch (collection["dropDownListTriggeringMode"])
{
case "Auto":
htmlToPdfConverter.TriggerMode = ConversionTriggerMode.Auto;
break;
case "WaitTime":
htmlToPdfConverter.TriggerMode = ConversionTriggerMode.WaitTime;
htmlToPdfConverter.WaitBeforeConvert = int.Parse(collection["textBoxWaitTime"]);
break;
case "Manual":
htmlToPdfConverter.TriggerMode = ConversionTriggerMode.Manual;
break;
default:
htmlToPdfConverter.TriggerMode = ConversionTriggerMode.Auto;
break;
}
// set header and footer
SetHeader(htmlToPdfConverter.Document);
SetFooter(htmlToPdfConverter.Document);
// set the document security
htmlToPdfConverter.Document.Security.OpenPassword = collection["textBoxOpenPassword"];
htmlToPdfConverter.Document.Security.AllowPrinting = collection["checkBoxAllowPrinting"].Count > 0;
// set the permissions password too if an open password was set
if (htmlToPdfConverter.Document.Security.OpenPassword != null && htmlToPdfConverter.Document.Security.OpenPassword != String.Empty)
htmlToPdfConverter.Document.Security.PermissionsPassword = htmlToPdfConverter.Document.Security.OpenPassword + "_admin";
// convert HTML to PDF
byte[] pdfBuffer = null;
if (collection["UrlOrHtmlCode"] == "radioButtonConvertUrl")
{
// convert URL to a PDF memory buffer
string url = collection["textBoxUrl"];
pdfBuffer = htmlToPdfConverter.ConvertUrlToMemory(url);
}
else
{
// convert HTML code
string htmlCode = collection["textBoxHtmlCode"];
string baseUrl = collection["textBoxBaseUrl"];
// convert HTML code to a PDF memory buffer
pdfBuffer = htmlToPdfConverter.ConvertHtmlToMemory(htmlCode, baseUrl);
}
FileResult fileResult = new FileContentResult(pdfBuffer, "application/pdf");
if (collection["checkBoxOpenInline"].Count == 0)
fileResult.FileDownloadName = "HtmlToPdf.pdf";
return fileResult;
}
private void SetHeader(PdfDocumentControl htmlToPdfDocument)
{
// enable header display
htmlToPdfDocument.Header.Enabled = m_formCollection["checkBoxAddHeader"].Count > 0;
if (!htmlToPdfDocument.Header.Enabled)
return;
// set header height
htmlToPdfDocument.Header.Height = 50;
float pdfPageWidth = htmlToPdfDocument.PageOrientation == PdfPageOrientation.Portrait ?
htmlToPdfDocument.PageSize.Width : htmlToPdfDocument.PageSize.Height;
float headerWidth = pdfPageWidth - htmlToPdfDocument.Margins.Left - htmlToPdfDocument.Margins.Right;
float headerHeight = htmlToPdfDocument.Header.Height;
// set header background color
htmlToPdfDocument.Header.BackgroundColor = PdfColor.WhiteSmoke;
string headerImageFile = m_hostingEnvironment.WebRootPath + "/DemoFiles/Images/HiQPdfLogo.png";
PdfImage logoHeaderImage = new PdfImage(5, 5, 40, headerImageFile);
htmlToPdfDocument.Header.Layout(logoHeaderImage);
// layout HTML in header
PdfHtml headerHtml = new PdfHtml(50, 5, @"<span style=""color:Navy; font-family:Times New Roman; font-style:italic"">
Quickly Create High Quality PDFs with </span><a href=""http://www.hiqpdf.com"">HiQPdf</a>", null);
headerHtml.FitDestHeight = true;
headerHtml.FontEmbedding = m_formCollection["checkBoxFontEmbedding"].Count > 0;
htmlToPdfDocument.Header.Layout(headerHtml);
// create a border for header
PdfRectangle borderRectangle = new PdfRectangle(1, 1, headerWidth - 2, headerHeight - 2);
borderRectangle.LineStyle.LineWidth = 0.5f;
borderRectangle.ForeColor = PdfColor.Navy;
htmlToPdfDocument.Header.Layout(borderRectangle);
}
private void SetFooter(PdfDocumentControl htmlToPdfDocument)
{
// enable footer display
htmlToPdfDocument.Footer.Enabled = m_formCollection["checkBoxAddFooter"].Count > 0;
if (!htmlToPdfDocument.Footer.Enabled)
return;
// set footer height
htmlToPdfDocument.Footer.Height = 50;
// set footer background color
htmlToPdfDocument.Footer.BackgroundColor = PdfColor.WhiteSmoke;
float pdfPageWidth = htmlToPdfDocument.PageOrientation == PdfPageOrientation.Portrait ?
htmlToPdfDocument.PageSize.Width : htmlToPdfDocument.PageSize.Height;
float footerWidth = pdfPageWidth - htmlToPdfDocument.Margins.Left - htmlToPdfDocument.Margins.Right;
float footerHeight = htmlToPdfDocument.Footer.Height;
// layout HTML in footer
PdfHtml footerHtml = new PdfHtml(5, 5, @"<span style=""color:Navy; font-family:Times New Roman; font-style:italic"">
Quickly Create High Quality PDFs with </span><a href=""http://www.hiqpdf.com"">HiQPdf</a>", null);
footerHtml.FitDestHeight = true;
footerHtml.FontEmbedding = m_formCollection["checkBoxFontEmbedding"].Count > 0;
htmlToPdfDocument.Footer.Layout(footerHtml);
// add page numbering
PdfFont pageNumberingFont = new PdfFont("Times New Roman", 8, true);
PdfText pageNumberingText = new PdfText(5, footerHeight - 12, "Page {CrtPage} of {PageCount}", pageNumberingFont);
pageNumberingText.HorizontalAlign = PdfTextHAlign.Center;
pageNumberingText.EmbedSystemFont = true;
pageNumberingText.ForeColor = PdfColor.DarkGreen;
htmlToPdfDocument.Footer.Layout(pageNumberingText);
string footerImageFile = m_hostingEnvironment.WebRootPath + "/DemoFiles/Images/HiQPdfLogo.png";
PdfImage logoFooterImage = new PdfImage(footerWidth - 40 - 5, 5, 40, footerImageFile);
htmlToPdfDocument.Footer.Layout(logoFooterImage);
// create a border for footer
PdfRectangle borderRectangle = new PdfRectangle(1, 1, footerWidth - 2, footerHeight - 2);
borderRectangle.LineStyle.LineWidth = 0.5f;
borderRectangle.ForeColor = PdfColor.DarkGreen;
htmlToPdfDocument.Footer.Layout(borderRectangle);
}
private PdfPageSize GetSelectedPageSize()
{
switch (m_formCollection["dropDownListPageSizes"])
{
case "A0":
return PdfPageSize.A0;
case "A1":
return PdfPageSize.A1;
case "A10":
return PdfPageSize.A10;
case "A2":
return PdfPageSize.A2;
case "A3":
return PdfPageSize.A3;
case "A4":
return PdfPageSize.A4;
case "A5":
return PdfPageSize.A5;
case "A6":
return PdfPageSize.A6;
case "A7":
return PdfPageSize.A7;
case "A8":
return PdfPageSize.A8;
case "A9":
return PdfPageSize.A9;
case "ArchA":
return PdfPageSize.ArchA;
case "ArchB":
return PdfPageSize.ArchB;
case "ArchC":
return PdfPageSize.ArchC;
case "ArchD":
return PdfPageSize.ArchD;
case "ArchE":
return PdfPageSize.ArchE;
case "B0":
return PdfPageSize.B0;
case "B1":
return PdfPageSize.B1;
case "B2":
return PdfPageSize.B2;
case "B3":
return PdfPageSize.B3;
case "B4":
return PdfPageSize.B4;
case "B5":
return PdfPageSize.B5;
case "Flsa":
return PdfPageSize.Flsa;
case "HalfLetter":
return PdfPageSize.HalfLetter;
case "Ledger":
return PdfPageSize.Ledger;
case "Legal":
return PdfPageSize.Legal;
case "Letter":
return PdfPageSize.Letter;
case "Letter11x17":
return PdfPageSize.Letter11x17;
case "Note":
return PdfPageSize.Note;
default:
return PdfPageSize.A4;
}
}
private PdfPageOrientation GetSelectedPageOrientation()
{
return (m_formCollection["dropDownListPageOrientations"] == "Portrait") ?
PdfPageOrientation.Portrait : PdfPageOrientation.Landscape;
}
}
}