Scrums.com logomark
SovTech is now Scrums.com! Same company, new name.
SovTech is now Scrums.com!!
Read more here

Web page to PDF API

API
By:
API Layer
Updated:
April 25, 2025

About this Cloud Hub Solution:

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

Modes:

Print Mode

This mode is activated by setting the print=true parameter. When print is set to true, the browser's print functionality generates the PDF file, resulting in a document with vector elements and selectable text. Additionally, you can specify grayscale=true to convert images to grayscale.

In printing mode, the default page size is A4. However, you can adjust the page size by passing a parameter, such as pagesize=B4, to accommodate larger formats like A3, Letter, or B5.

In cases where URLs require HTTP Realm authentication with a username and password, you can provide these credentials by setting 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 not optimized for printing, resulting in inconsistent output. In such cases, taking a screenshot and converting it to PDF may be the best option. This can be achieved by setting the print parameter to false.

When print=false, the API retrieves the specified URL and captures a screenshot as it appears in a Chrome browser, then saves the output as a PDF file. The browser's screen resolution is 1400x1080 pixels, ensuring a sharp and clean output.

The resulting PDF will contain a full-page screenshot, automatically scrolling and capturing the entire height of the webpage (up to a maximum height of 10,000 pixels). You can also customize the wait time for taking a screenshot by using the timeout parameter, specifying a value in seconds (e.g., timeout=5). The maximum timeout value is 15 seconds.

Our API uses up-to-date Chrome browsers to capture pixel-perfect screenshots and support 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'

Explore Tech Stacks Related to

Web page to PDF API

Looking To Build Software Of Your Own?

Custom Software Development

Custom app solutions.
Explore software development
arrow

Mobile App Development

Custom mobile development.
Explore mobile app development
arrow

Product Design

User interface/User experience design
Explore product design
arrow

Web App Development

Custom web development
Explore web app development
arrow