Web page to PDF API

By
API Layer
Convert any web page URL to PDF.
Web page to PDF API
From
10
Vendor
API Layer

Features

Convert web pages to PDFs

Provides PDF metadata

Supports multiple PDF formats

Offers APIs for developers

Scalable and fast PDF processing

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:

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:

Highlights

Convert web pages to PDFs

Provides PDF metadata

Supports multiple PDF formats

Offers APIs for developers

Scalable and fast PDF processing

Code