Generate PDF API

URL to PDF generator API to generate PDF file of a Website or Webpage from a URL.

POST https://api.htmlcsstoimg.com/api/v1/generatePdf

Generates a PDF file from a Web URL or generates a PDF from HTML & CSS

Headers

NameTypeDescription

CLIENT-API-KEY*

String

API Key for your account. Will be available on your dashboard.

Request Body

NameTypeDescription

paperWidth

number

With of the paper of PDF. (optional with paper_size in px),

paperHeight

number

Height of the paper of PDF.(optional with paper_size in px),

paper_size

Size of the paper, Any out of [‘A3’, ‘A4’, ‘A5’, ‘Letter’, ‘Legal’]. (Optional with width and height),

url

String

URL of the Webpage whose PDF is to be generated.

html_content

String

HTML Content to be used for PDF generation.

css_content

String

CSS Content to be used for PDF generation

generate_pdf_url

Boolean

Whether the output should return the image or the PDF URL. Default value is true.

wait_till

Number

Number of seconds to wait before capturing a screenshot from the URL. Default value is 0.

landscape

Boolean

Page orientation where the content is formatted horizontally. By default the page orientation is Portrait.(default : false)

displayHeaderFooter

Boolean

Generated PDF with have header and Footer on each page.(default=false)

printBackground

Boolean

Prints any background colors or images used on the web page to the PDF. Its default value is true.

preferCSSPageSize

Boolean

Get size from CSS styles.(default=True))

Last updated