API Basics
★  Fundamentals
★  Error Codes
★  Examples
★  Specification
★  SDKs
Data Tools
Security and Networking

HTML5 Render

Render HTML and HTML5 content to PDF, JPG or PNG.

HTML5 render is based on the WebKit browser engine, this provides excellent rendering quality and will even execute JavaScript code on web pages. This API has two main modes, render to PDF and render to image (JPG or PNG). When rendering to PDF the HTML will be laid out using the actual page size requested, so for the default A4 page size the HTML will be rendered as if it was displayed on 210mm x 297mm "screen". You can change the way this works by adjusting the page size, orientation, zoom, margin and media query options. When in image mode the main factor to the layout of the page is the image-width and image-height values. Some options have no effect while in image mode, for example page-size and margins.

If your web page uses responsive CSS and has a mobile view which you would like to render instead, set the media-queries flag to emulate this. If you need to make minor adjustments to the page you can also pass some custom CSS which will override any CSS on the page, however the preferred method to do this is by putting "@media print" CSS queries in the original document.

End Point

Test API
API Request
contentYesstringThe HTML content. This can be either a URL to load HTML from or an actual HTML content string
formatNostringPDFWhich format to output, available options are: PDF, PNG, JPG
page-sizeNostringA4Set the document page size, can be one of: A0 - A9, B0 - B10, Comm10E, DLE or Letter
titleNostringThe document title
marginNointeger0The document margin (in mm)
margin-leftNointeger0The document left margin (in mm)
margin-rightNointeger0The document right margin (in mm)
margin-topNointeger0The document top margin (in mm)
margin-bottomNointeger0The document bottom margin (in mm)
landscapeNobooleanfalseSet the document to lanscape orientation
zoomNofloat1.0Set the zoom factor when rendering the page (2.0 for double size, 0.5 for half size)
grayscaleNobooleanfalseRender the final document in grayscale
media-printNobooleanfalseUse @media print CSS styles to render the document
media-queriesNobooleanfalseActivate all @media queries before rendering. This can be useful if you wan't to render the mobile version of a responsive website
formsNobooleanfalseGenerate real (fillable) PDF forms from HTML forms
cssNostringInject custom CSS into the HTML. e.g. 'body { background-color: red;}'
image-widthNointeger1024If rendering to an image format (PNG or JPG) use this image width (in pixels)
image-heightNointegerIf rendering to an image format (PNG or JPG) use this image height (in pixels). The default is automatic which dynamically sets the image height based on the content
API Response

Free limit: 25/day