Web page to PDF API

Web page to PDF API

Convert any web page URL to PDF.

Response example. If you want to see more check the documentation.

Free Plan $0.00 Monthly Subscribe
100 Requests / Monthly
Free for Lifetime
No Credit Card Required
MOST POPULAR
Starter Plan $9.99 Monthly Subscribe
500 Requests / Monthly
Standard Support
Pro Plan $19.99 Monthly Subscribe
3,000 Requests / Monthly
Standard Support
Custom Plan Volume Monthly Contact Us
Any requests volume you need

Renders the provided URL and prints it as a PDF file as it should be displayed in a Google Chrome browser.

This API has two modes.

Print Mode

This mode is triggered with print=true (default)parameter. When print is set to true, the PDF file will be generated by browser's print functionality and the elements in the resulting PDF will be vectors and texts will be selectable.

When in printing mode, you can also define grayscale=true in order to get images in grayscale.

The PDF will be printed on A4 pagesize by default. If you need larger pages such as A3, B4 or simply Letter or B5 just set it such as passing the pagesize=B4 parameter

Sometimes you have HTTP Realm authentications that requires username and passwords to reach the URLs. You can set them such as username=john&password=secret

A sample request with cURL is below:

curl --request GET \
--url 'https://api.apilayer.com/url_to_pdf?url=google.com&grayscale=true&pagesize=B4' \
--header 'apikey: YOUR API KEY'

Screenshot Mode

Some web pages are just not optimized for printers. So the result may be flaky. You may have no choice but to take a screenshot and then convert it to PDF. You can achieve this functionality by simply setting the print parameter to false.

When print=false, the API fetches the provided URL and takes a screenshot as it is displayed on an actual Chrome browser and then serves the output as a PDF file. The browser has a screen resolution of 1400x1080 pixels, so the output is sharp and clean.

The PDF will contain full page screenshots. It will scroll automatically and take a full height screenshot of your web page. (max height: 10.000 pixels)

You can also customize the wait time (in seconds) for taking a screenshot with the timeout parameter. Just pass timeout=5 or any value you desire for your needs. (max timeout value is 15 seconds)

We use up to date Up to date Chrome browsers to make pixel perfect screenshots and ensure support for all modern web features.

A sample cURL request to trigger screensot mode is below:

curl --request GET \
--url 'https://api.apilayer.com/url_to_pdf?url=google.com&print=false' \
--header 'apikey: YOUR API KEY'