HTML To PDF API – V1

This page refers to v1 of SelectPdf Online HTML to PDF REST API. To read about the latest version of the API, please use the following link: HTML To PDF REST API.

The Select.Pdf online API is a professional solution that lets you create PDF from web pages and raw HTML code in your applications. The API is easy to use and the integration takes only a few lines of code.

Features

  • Create PDF from any web page or html string.
  • Full html5/css3/javascript support.
  • Set PDF options such as page size and orientation, margins, security, web page settings.
  • Easy integration, no third party libraries needed.
  • Works in all programming languages.
  • No installation required.

Usage

It’s very easy to use Select.Pdf Html to Pdf API. All you need is a license key and with SelectPdf online API you will be able to convert any url or html raw code to pdf in an instant.
Here a basic usage example:

http://selectpdf.com/api/?key=your_license_key_here&url=http://www.testurl.com

The request needs the following components:

  1. end point – this should be http://selectpdf.com/api/.
  2. key – the license key required to use the API. Request a demo license key.
  3. url or html – the url or raw html string that will be converted to PDF.

Only GET requests can be used with the current version of SelectPdf online API. It’s important to remember the following things:

  1. Send all parameters via query string.
  2. url, html and base_url parameters need to be URL encoded.
  3. Use any of the parameters below to customize the pdf conversion. If a parameter is missing, the default value is used by the converter.

Options

In addition to the key, url, html and base_url, the following parameters can be customized:

Page size
page_size– Specifies the page size of the generated pdf document. The default value is A4. All possible values are: A1, A2, A3, A4, A5, Letter, HalfLetter, Ledger, Legal.

Page orientation
page_orientation – Specifies the page orientation of the generated pdf document. The default value is Portrait. All possible values are: Portrait, Landscape.

Page margins
margin_top, margin_right, margin_bottom, margin_left – You can specify values for all 4 margins of the generated pdf document. The margins are specified in points. 1 point is 1 / 72 inch. By default all margins are 5pt.

Page numbers
page_numbers – If this feature is enabled, in the footer of each pdf page, the current page number will be displayed. The default value is True. All possible values are: True, False.

Pdf security
user_password – Specifies a password needed to be able to view the generated pdf document.
owner_password – Specifies a password needed to be able to view or modify the generated pdf document.

CSS Media Type
use_css_print – Specifies if the CSS Print media type is used instead of the Screen media type. The default value is False. All possible values are: True, False.

Web page options
web_page_width – The width used by the converter’s internal browser window. The default value is 1024px.
web_page_height – The height used by the converter’s internal browser window. The default value is 0px and it means that the page height is automatically calculated by the converter.

min_load_time – Introduces a delay (in seconds) before the actual conversion to allow the web page to fully load. The default value is 1 second. Use a larger value if the web page has content that takes time to render when it is displayed in the browser.
max_load_time – It’s the maximum amount of time (in seconds) that the convert will wait for the page to load. A timeout error is displayed when this time elapses. The default value is 30 seconds. Use a larger value (up to 120 seconds allowed) for pages that take a long time to load.

Return Codes

Our API returns HTTP response codes, which you can check to see if the conversion was successful or not. Here is the list of HTTP codes used by Select.Pdf:

200 OK – The API call succeeded. The pdf document is returned.
400 Bad Request – Url or html string not specified. The body of the response contains an explanation in plain text.
401 Authorization Required – License key not specified or invalid. The body of the response contains an explanation in plain text.
499 Custom – Conversion error. The body of the response contains an explanation in plain text.

Test Select.Pdf online API Now

Request a demo license key right now. Feel free to ask any questions if needed.