Free HTML to PDF Converter for .NET and C#

HiQPdf Library Box HiQPdf Free HTML to PDF Converter for .NET is a limited version of the fully featured HiQPdf Library for .NET. It allows you to create PDF documents directly from HTML pages in your ASP.NET and MVC Websites, Desktop Applications and Services.

You can use the free library in .NET 4.0 and later applications, in C# and VB.NET languages, on 32-bit and 64-bit Windows machines.

list itemAmazingly Fast and Precise HTML to PDF Conversion Technology

The HiQPdf HTML to PDF Converter for .NET offers you the fastest and the most precise HTML to PDF conversion technology you can use in your .NET applications. The library can convert any HTML document to PDF, not matter how complex the HTML content would be, preserving all the CSS styles and executing all the JavaScript scripts found in the HTML document.

list itemConvert Modern HTML5 Documents with CSS3, SVG, Canvas and JavaScript

The HiQPdf HTML to PDF Converter can render HTML documents with last generation content like SVG, Web Fonts and CSS3 styles. The JavaScript engine is fast and can easily handle complex scripts allowing you to use the latest powerful JavaScript libraries existing on market

list itemSupport for Web Fonts and Web Open Font Format (WOFF)

The HiQPdf HiQPdf HTML to PDF Converter for .NET can convert HTML documents using Web Fonts which are a great tool for web designers to create special effects on text in a HTML document. The Web Fonts are downloaded on the fly by converter and used to render the HTML document to PDF without installing those fonts on the local machine

list itemNo External Dependencies, Direct Copy Deployment

The HiQPdf Software does not depend on installed browsers, printer drivers, viewers or any other third party software. The HiQPdf Library for .NET can be deployed by simply copying it on the server. It is also possible to install the library in the .NET Framework GAC

list itemASP.NET, MVC and Desktop Samples, Complete Documentation, 24x7 Technical Support

The HiQPdf HTML to PDF Converter for .NET from HiQPdf comes with a suite of ASP.NET and Windows Forms samples with complete source code in C#. The features of the library are well documented and a complete API reference in Microsoft Help format is provided. If you need more help you can contact our support team at any time

list itemCreate up to 3 PDF Pages of High Quality Content for Free

While the full version of the software allows you to create an unlimited number of PDF pages, with the HiQPdf HTML to PDF Converter for .NET you can create up to 3 PDF pages. This is the most important limitation of the free version which can be used only for creating small and medium PDF documents. There are also many advanced features like live URLs, internal links, outlines, PDF forms, edit, merge and split PDF documents, extract text and images from PDF or PDF pages rasterization which are available only in the full version of the software.

HQPdf HTML to PDF Detailed FeaturesDetailed Features

Below you can find a detailed description of the most important features of the HiQPdf HiQPdf HTML to PDF Converter for .NET

  • Convert HTML and HTML5 Documents and Web Pages to PDF - With HiQPdf HTML to PDF Converter Library for .NET you can convert HTML documents with CSS3, JavaScript, SVG and Web Fonts to PDF
  • Convert URLs and HTML Strings to PDF Files or Memory Buffers - The HiQPdf HTML to PDF Converter for .NET can produce the PDF documents directly in a PDF file on server or in a memory buffer that can be further manipulated.
  • Set the PDF Page Size and Orientation - The HiQPdf HTML to PDF Converter Library for .NET allows you to set the output PDF page size and orientation. The PDF page can be of any custom size, not only a standard size.
  • Fit HTML Content in PDF Page Size - The HiQPdf HTML to PDF Converter Library for .NET allows you to set various options to automatically fit the HTML content in output PDF page size.
  • Advanced Support for Web Fonts in .WOFF and .TTF Formats - The HiQPdf HTML to PDF Converter can use and embed in PDF any web font defined in HTML page with the @font-face rules
  • Advanced Support for Scalar Vector Graphics (SVG) - The HiQPdf HTML to PDF Converter can accurately SVG to PDF. The charts and advanced graphics components are using SVG in HTML pages for rendering
  • Advanced Support for HTML5 and CSS3 - The HiQPdf HTML to PDF Converter offers full support for most of the CSS3 features like selectors, text effect, 2D and 3D transformations
  • Delayed Conversion Triggering Mode - By default the conversion is automatically triggered when the HTML is loaded. It is also possible to wait a constant interval before triggering conversion to PDF.
  • Control PDF page breaks with page-break CSS attributes in HTML - Use the CSS 'page-break-before:always', 'page-break-after:always' and and 'page-break-inside:avoid' CSS attributes in HTML to force or avoid page breaks in PDF
  • Repeat HTML Table Header and Footer on Each PDF Page - The thead and tfoot tags content of a HTML table are automatically repeated at the top and bottom of all PDF pages where the HTML table is rendered
  • Packaged and Delivered as a Zip Archive - The HiQPdf HTML to PDF Converter for .NET is distributed as a Zip archive and does not need to be installed to ensure that no unwanted changes are done to your computer
  • No External Dependencies - The HiQPdf HTML to PDF Converter for .NET does not depend on installed browsers, printer drivers, viewers or any other third party software
  • Direct Copy Deployment Supported - The HiQPdf HTML to PDF Converter for .NET can be deployed by simply copying it on the server. It is also possible to install the library in the .NET Framework GAC
  • ASP.NET and Windows Forms Samples, Complete Documentation - The HiQPdf HTML to PDF Converter for .NET package includes ASP.NET and Windows Forms samples with C# source code and the library API is well documented
  • Supported on All Windows Versions - The HiQPdf library is compatible with all the Windows versions starting with Windows XP and Windows Server 2003 and it works both on 32-bit and 64-bit Windows machines
  • Create for Free Maximum 3 Pages of High Quality PDF Content - The HiQPdf HTML to PDF Library for .NET allows you to create maximum 3 PDF pages for free. To remove this limitation you have to use the full version of the software

HiQPdf HTML to PDF Converter for .NET - C# Code Sample for ASP.NET

protected void buttonConvertToPdf_Click(object sender, EventArgs e)
{
    // create the HTML to PDF converter
    HtmlToPdf htmlToPdfConverter = new HtmlToPdf();

    // set browser width
    htmlToPdfConverter.BrowserWidth = int.Parse(textBoxBrowserWidth.Text);

    // set browser height if specified, otherwise use the default
    if (textBoxBrowserHeight.Text.Length > 0)
        htmlToPdfConverter.BrowserHeight = int.Parse(textBoxBrowserHeight.Text);

    // set HTML Load timeout
    htmlToPdfConverter.HtmlLoadedTimeout = int.Parse(textBoxLoadHtmlTimeout.Text);

    // set PDF page size and orientation
    htmlToPdfConverter.Document.PageSize = GetSelectedPageSize();
    htmlToPdfConverter.Document.PageOrientation = GetSelectedPageOrientation();

    // set PDF page margins
    htmlToPdfConverter.Document.Margins = new PdfMargins(0);

    // set a wait time before starting the conversion
    htmlToPdfConverter.WaitBeforeConvert = int.Parse(textBoxWaitTime.Text);

    // convert HTML to PDF
    byte[] pdfBuffer = null;

    if (radioButtonConvertUrl.Checked)
    {
        // convert URL to a PDF memory buffer
        string url = textBoxUrl.Text;

        pdfBuffer = htmlToPdfConverter.ConvertUrlToMemory(url);
    }
    else
    {
        // convert HTML code
        string htmlCode = textBoxHtmlCode.Text;
        string baseUrl = textBoxBaseUrl.Text;

        // convert HTML code to a PDF memory buffer
        pdfBuffer = htmlToPdfConverter.ConvertHtmlToMemory(htmlCode, baseUrl);
    }

    // inform the browser about the binary data format
    HttpContext.Current.Response.AddHeader("Content-Type", "application/pdf");

    // let the browser know how to open the PDF document, attachment or inline, and the file name
    HttpContext.Current.Response.AddHeader("Content-Disposition", String.Format("{0}; filename=HtmlToPdf.pdf; size={1}",
        checkBoxOpenInline.Checked ? "inline" : "attachment", pdfBuffer.Length.ToString()));

    // write the PDF buffer to HTTP response
    HttpContext.Current.Response.BinaryWrite(pdfBuffer);

    // call End() method of HTTP response to stop ASP.NET page processing
    HttpContext.Current.Response.End();
}