Product

pdfHTML

Intro

iText 7 pdfHTML

Convert HTML to PDF

pdfHTML is an HTML to PDF converter, that easily converts HTML and CSS into PDF documents. As an iText 7 add-on you can use pdfHTML for out-of-the-box solutions, or on its own. With the iText pdfHTML tool you can easily convert HTML to PDF and create professionally formatted rich, smart PDF reports and documents. You can integrate the API into your workflow and convert HTML into PDF documents which are standards compliant and are accessible, searchable and usable for indexing.

How it works

With just few lines of code you can use pdfHTML to get great results in no time. This code sample demonstrates how to use pdfHTML to convert a source HTML file (input.html) into a PDF (output.pdf). Click the button in the code window below to switch between the Java and C# examples.

1
2
3
4
5
6
7
8
9
public static void main() throws IOException {
        // IO
        File htmlSource = new File("input.html");
        File pdfDest = new File("output.pdf");
         // pdfHTML specific code
        ConverterProperties converterProperties = new ConverterProperties();
        HtmlConverter.convertToPdf(new FileInputStream(htmlSource), 
       new FileOutputStream(pdfDest), converterProperties);
    }
1
2
3
4
5
6
7
8
9
static void Main(string[] args)
  {
    using (FileStream htmlSource = File.Open("input.html", FileMode.Open))
    using (FileStream pdfDest = File.Open("output.pdf", FileMode.OpenOrCreate))
    {
        ConverterProperties converterProperties = new ConverterProperties();
        HtmlConverter.ConvertToPdf(htmlSource, pdfDest, converterProperties);
    }
  }

 

Below you can see an example of pdfHTML in action; using it to convert a web page into a PDF.

 

The original web page

HTML to PDF example input file

After the pdfHTML conversion

HTML to PDF example output

Key features

Core capabilities of iText 7 pdfHTML

pdfHTML provides a convenient API which allows you to convert HTML files straight to PDF files or to a list of iText elements. This gives you full control over how to parse and insert the HTML elements. When using pdfHTML to convert HTML to PDF you will realize another great advantage. Semantic and structural information contained in the HTML files is an excellent source for pdfHTML to convert the HTML files into rich, smart PDF documents.

Leverage HTML flexibility in PDF

Core capabilities development icon
  • Convert static HTML5 and CSS3 to PDF
  • The conversion is customizable, dynamic and simple through an easy to use API. 

Conversion options

Core capabilities development icon
  • Convert a full document to PDF directly.
  • Convert an HTML snippet to "iText building blocks", e.g. an HTML rich text paragraph into an iText Paragraph object.

Create PDFs that are compliant with PDF standards

Core capabilities development icon
  • More specifically, PDF/A, PDF/UA and Tagged PDFs.

Customizable

Core capabilities development icon
  • Add dynamic content to your PDF such as barcodes.
  • Leverage converter properties and custom processing of tags to fine-tune your conversion.

Benefits

Why use iText 7 pdfHTML?

Re-use the structural information from HTML to easily create PDF/A, PDF/UA, or Tagged PDFs. pdfHTML provides the engine to convert HTML to PDF and the results are well-formatted, well-structured PDF documents. There is no need to know the technical details of the PDF format, pdfHTML utilizes semantic and structural information already present in the HTML.

Easily integrates with HTML tools

pdfHTML convert HTML to PDF pdfHTML provides the engine to convert HTML to PDF

By using HTML and CSS to layout and style your document, you can leverage your existing HTML and CSS skills to create PDFs. This add-on easily integrates with HTML tools.

Out of the box and customized options for HTML to PDF conversion.

pdfHTML convert HTML to PDF pdfHTML provides the engine to convert HTML to PDF

The HTML elements are already mapped to iText elements based on HTML5 and CSS3. To customize, you simply add your own handlers to the pdfHTML framework.

Create a structured PDF document

pdfHTML convert HTML to PDF pdfHTML provides the engine to convert HTML to PDF

Convert HTML to PDF with pdfHTML and use the structural and semantic information from HTML to create PDF/A, PDF/UA or Tagged PDFs and create standards compliant PDF documents. 

Satisfied Customers

Quote
iText is a breeze! Using a proven and tested PDF technology helped us to focus on what we do best — building a high quality mobile app.

Quote
We chose the iText library because it was the only solution that allowed easy integration into our open standards architecture.

Quote
With iText we have the peace of mind that we are delivering a solid solution to our client.