The ExpertPdf HTML to PDF Converter allows a very fine control of the PDF rendering process. The default settings of the converter should be acceptable for majority of the situations but sometimes more control and customizations is necessary. This section offers a summary of the main properties of the converter that can be set to control the rendering of the PDF document.
The ExpertPdf converter supports the following CSS styles to control the page breaks: page-break-before:always, page-break-after:always and page-break-inside:avoid. For example, with the page-break-after:always style applied to a HTML element (image, text, etc) you instruct the converter to insert a page break right after that element is rendered.
ExpertPdf provides full support for pdf document headers and footers. In order to show or hide the header or footer on the rendered document you have to set the ShowHeader and ShowFooter properties of the PdfDocumentOptions property of the PdfConverter class. For example, to add both footer and header to the generated document you can use the following code:
As part of ExpertPdf HtmlToPdf Converter, there is also the ImgConverter class. This class defines a set of methods to render a image from a URL or from a HTML string. The conversion result can be a stream of bytes as byte object or a file on the disk. The image bytes can be further saved in a disk file or can be send a HTTP response to the client browser.
The converter API is fully documented in the Doc/HtmlToPdf.chm that can be found in the product archive that can be downloaded from www.html-to-pdf.net. In order to use the converter library you have include the ExpertPdf.HtmlToPdf namespace in your application. The main classes in this namespace is the PdfConverter class and the ImgConverter class which expose the methods you can use to render a PDF document or an image from a URL or a HTML string. Below is a brief description of the main classes and properties of the converter.
The ExpertPdf HTML to PDF Converter for .NET is delivered as a zip archive and it doesn’t have an installer. You have to unzip the archive in a folder on the disk. Below is a brief description of the folders from the archive.
The ExpertPdf HTML to PDF Converter for .NET consists in a .NET library that can be used directly in any .NET application (ASP.NET, Windows Forms, Console, Web Services, Windows Services, etc). The converter does not require any installation and it does not use any printer driver to perform conversion. It’s just an assembly that you can directly link with your .NET application. The full HTML / CSS set is supported and the main goal of the converter is to preserve unchanged the original aspect of the converted HTML page.