HTM to PDF API

The API for converting HTML files to PDF files using Google Chrome browser.

HTM PDF

The API for converting HTML files to PDF files.

Copy parameter's URL Secret Secret
Type: String

Authentication secret must be provided as a query parameter. If omitted, token must be provided.

Show all
Copy parameter's URL Token Token
Type: String

Authentication token must be provided as a query parameter. If omitted, secret must be provided.

Show all
Copy parameter's URL File File Required
Type: File

File to be converted. Value can be URL or file content.

Show all
Copy parameter's URL StoreFile Store file
Type: Bool

Store converted file on our secure server and provides download URL.

Default: False Show all
Copy parameter's URL FileName File name
Type: String

Converted output file name without extension. The extension will be added automatically.

Show all
Copy parameter's URL Timeout Timeout
Type: Integer

Conversion timeout in seconds.

Default: 120 Range: 10 .. 1200 Show all
Copy parameter's URL AuthUsername Authentication username
Type: String

HTTP authentication username. Could be used if conversion web page is protected with HTTP authentication.

Show all
Copy parameter's URL AuthPassword Authentication password
Type: String

HTTP authentication password. Could be used if conversion web page is protected with HTTP authentication.

Show all
Copy parameter's URL Cookies Cookies for the page request
Type: String

Set additional cookies for the page request. Exaple:
cookiename1=cookievalue1; cookiename2=cookievalue2; cookiename3=cookievalue3

Show all
Copy parameter's URL PageRange Page Range
Type: String

Set page range. Example 1-10 or 1,2,5.

Default: 1-100 Show all
Copy parameter's URL ConversionDelay Conversion delay
Type: Integer

Delay in seconds before page load and PDF creation. Sometimes useful to let web page fully load.

Default: 0 Range: 0 .. 30 Show all
Copy parameter's URL AdBlock Ad block
Type: Bool

Block ads in converting page.

Default: False Show all
Copy parameter's URL CookieConsentBlock Remove cookie warnings
Type: Bool

Tries to remove EU regulation required cookie warnings from web pages.

Default: False Show all
Copy parameter's URL JavaScript Enable JavaScript
Type: Bool

Allow web pages to run JavaScript.

Default: True Show all
Copy parameter's URL WaitElement Wait for DOM element
Type: String

Element selector string of the DOM element. Converter will wait for this element to appear in DOM before conversion begins.

Show all
Copy parameter's URL UserJs Execute JavaScript
Type: String

Execute provided JavaScript before conversion begins.

Show all
Copy parameter's URL UserCss Apply additional CSS
Type: String

Apply additional CSS before conversion begins.

Show all
Copy parameter's URL HideElements Hide DOM elements
Type: String

Element selector string of the DOM elements that needs to be hidden during conversion.

Show all
Copy parameter's URL CssMediaType CSS media type
Type: String

Use CSS media type in conversion process. The default screen and print media types are supported but not limited to these. The custom media type, like convertapi can be used too.

Default: screen Show all
Copy parameter's URL LoadLazyContent Load lazy content
Type: Bool

Load page images that loads only when they are visible.

Default: False Show all
Copy parameter's URL ViewportWidth Viewport width
Type: Integer

Sets browser viewport width.

Default: 1366 Range: 200 .. 4000 Show all
Copy parameter's URL ViewportHeight Viewport height
Type: Integer

Sets browser viewport height.

Default: 1024 Range: 200 .. 4000 Show all
Copy parameter's URL Background Background
Type: Bool

Convert web page background.

Default: True Show all
Copy parameter's URL FixedElements Fixed elements
Type: Collection

Change fixed elements CSS 'position' property to adapt page for conversion.

Default: fixed Values: fixed absolute relative hide Show all
Copy parameter's URL ShowElements Show DOM elements
Type: String

Element selector string of the DOM elements that should be visible during conversion. Other elements will be hidden.

Show all
Copy parameter's URL AvoidBreakElements Avoid page break inside DOM elements
Type: String

CSS selector for the elements that pages should not break.

Show all
Copy parameter's URL BreakBeforeElements Page break before DOM elements
Type: String

CSS selector for the elements that should apply page break before it.

Show all
Copy parameter's URL BreakAfterElements Page break after DOM elements
Type: String

CSS selector for the elements that should apply page break after it.

Show all
Copy parameter's URL RespectViewport Respect viewport
Type: Bool

If true, the converter will generate PDF as the content looks like in the browser. If is set to false, the converter acts like Chrome print to PDF function.

Default: True Show all
Copy parameter's URL Scale Scale Content
Type: Integer

Set web page scale value in percentage.

Default: 100 Range: 10 .. 200 Show all
Copy parameter's URL MarginTop Margin top
Type: Integer

Set the page top margin in millimeters (mm).

Default: 10 Range: 0 .. 500 Show all
Copy parameter's URL MarginRight Margin right
Type: Integer

Set the page right margin in millimeters (mm).

Default: 10 Range: 0 .. 500 Show all
Copy parameter's URL MarginBottom Margin bottom
Type: Integer

Set the page bottom margin in millimeters (mm).

Default: 10 Range: 0 .. 500 Show all
Copy parameter's URL MarginLeft Margin left
Type: Integer

Set the page left margin in millimeters (mm).

Default: 10 Range: 0 .. 500 Show all
Copy parameter's URL Header Header HTML
Type: String

Adds a HTML header to every page. HTML tags with the classes 'pageNumber', 'totalPages', 'title', 'date' will be injected with the page metadata. Use inline CSS to style provided HTML.

Show all
Copy parameter's URL Footer Footer HTML
Type: String

Adds a HTML footer to every page. HTML tags with the classes 'pageNumber', 'totalPages', 'title', 'date' will be injected with the page metadata. Use inline CSS to style provided HTML.

Show all
Copy parameter's URL PageOrientation Page orientation
Type: Collection

PDF page orientation.

Default: portrait Values: portrait landscape Show all
Copy parameter's URL PageSize Page size
Type: Collection

PDF page size.

Default: letter Values: a0 a1 a2 a3 a4 a5 a6 a7 a8 a9 b0 b1 b2 b3 b4 b5 letter legal ledger Show all
Copy parameter's URL PageWidth Page width
Type: Integer

Custom page width in millimeters (mm). This option override PageSize option.

Range: 10 .. 30000 Show all
Copy parameter's URL PageHeight Page height
Type: Integer

Custom page height in millimeters (mm). This option override PageSize option.

Range: 10 .. 30000 Show all
Copy parameter's URL CompressPDF Compress PDF
Type: Bool

It tries to produce smaller output files but requires Adobe Reader 6, released in 2003 or newer, to view created PDF files.

Default: False Show all

Code snippet

// Code snippet is using the ConvertAPI JavaScript Client: https://github.com/ConvertAPI/convertapi-js

// Code snippet is using the ConvertAPI Node.js Client: https://github.com/ConvertAPI/convertapi-nodejs

// Code snippet is using the ConvertAPI PHP Client: https://github.com/ConvertAPI/convertapi-php

// Code snippet is using the ConvertAPI Java Client: https://github.com/ConvertAPI/convertapi-java

// Code snippet is using the ConvertAPI C# Client: https://github.com/ConvertAPI/convertapi-dotnet

# Code snippet is using the ConvertAPI Ruby Client: https://github.com/ConvertAPI/convertapi-ruby

# Code snippet is using the ConvertAPI Python Client: https://github.com/ConvertAPI/convertapi-python

// Code snippet is using the ConvertAPI Go Client: https://github.com/ConvertAPI/convertapi-go

REM Code snippet is using the command line utility program: https://github.com/ConvertAPI/convertapi-cli

<!-- For conversions with the multiple file result please refer to this example: https://repl.it/@ConvertAPI/HTML-Form-with-multiple-file-result -->