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.
It can be used as general purpose tool for converting web pages and HTML code to PDF or as part of our Reporting Toolkit for .NET to easily create PDF reports directly from ASP.NET pages. If you think that the converted ASP.NET page can contain your preferred server controls like charts, barcodes, data bound control like data grids and repeaters you can realize how powerful this tool can be.
The converter API offers methods to convert a web page from a specified URL to PDF or a specified HTML string. Additionally you can convert web pages and HTML code to images in any format supported by .NET framework (BMP, JPEG, PNG, GIF, etc).
If you want to get started immediately without reading the next sections of this document this is something perfectly possible. First you have to add a reference to the converter library assembly ephtmltopdf.dll in your .NET or ASP.NET project. Since v9.0, a new dll is needed by the converter (epengine.dll). That needs to be in the same folder with ephtmltopdf.dll, but it does not need a reference in Visual Studio.
Then you have to add the following two lines of code in your application. The first one will import the converter namespace and the second one will call the converter to render the web page from the specified url as an array of bytes representing the resulted PDF document:
byte pdfBytes = new PdfConverter().GetPdfFromUrlBytes(url);
Further you can save the PDF document bytes into a file on disk or you can send the bytes as a response to the client browser. We provide full sample applications, both in C# and VB.NET to exemplify both situations.
The code above will produce a PDF document based on the default settings of the library which is enough for the most of the situations. However, the converter library offers a large number of parameters that you can set to customize the conversion process. You can add headers and footers with text and images to the resulted PDF document, specify page orientation, page size, compression level of the resulted PDF document, encrypt the resulted document and set user and owner password, set the permissions for printing.