iLovePDF Developers
Log in Sign up

HTML to PDF Guide
How to integrate the HTML to PDF Converter to save web pages as PDF using iLovePDF’s REST API.

Remember that in order to use our Tool Guides, you need to have previous knowledge about the basics to processing a PDF with our REST API. We strongly recommend that you read the Processing a PDF guide before starting this one.

Basic HTML to PDF

The following are the four basic lines to work with HTML to PDF:

Basic HTML to PDF

You can add as many urls as you want to convert after creating a task for the HTML to PDF tool to process.

Advanced HTML to PDF

You can customize some options of your HTML conversion to PDF with the following functions:

Change PDF orientation

Change PDF orientation

With orientation you can change your final PDF file from portrait to landscape.

Set page margin

Set page margin

page-margin allows you to set a margin between the PDF page and its content. If you don’t set any margin, your final PDF will have no margin.

Set page size

Set page size

One way to ensure that your final PDF has a document size is to force it with page-size. The API provides several standard sizes to choose from:

  • A3, A4, A5, A6. Your final document will have an AX standard size and your web page will fit in that size.
  • Letter. Your final document will have Letter standard size and your web page will fit in that size.
  • Fit, Auto. Your final document will have the same size as the original web page.

Viewer Width

Viewer Width

With view-width option you can set how the size of the device screen where the website would be rendered. You can choose these screen sizes by width in pixels. Default value is 1980.

Make a single output page

Make a single output page

When single-page is true, the web page will be converted into a single PDF page document as long as the website, instead of being separated by PDF pages. That is all you can do with HTML to PDF converting.