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.
- Create PDF from any web page or html string.
- 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.
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:
The request needs the following components:
- end point – this should be http://selectpdf.com/api/.
- key – the license key required to use the API. Request a demo license key.
- 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:
- Send all parameters via query string.
- url, html and base_url parameters need to be URL encoded.
- Use any of the parameters below to customize the pdf conversion. If a parameter is missing, the default value is used by the converter.
In addition to the key, url, html and base_url, the following parameters can be customized:
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 – Specifies the page orientation of the generated pdf document. The default value is Portrait. All possible values are: Portrait, Landscape.
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 – 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.
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.
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.