Web page to PDF API
Convert any web page URL to PDF.
More Details
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'
{
"pdf_url": "https://assets.apilayer.com/url_to_pdf/f602f83c-e06e-11ea-b14c-0242ac140002.pdf",
"requested_url": "http://apilayer.com"
}
Take a look at the diverse range of application types and industries that can leverage this solution. Understanding these potential uses can help identify how this can integrate into different business models and digital solutions across various sectors.
We've outlined the compatible tech stacks for this solution, encompassing various development areas like frontend, backend, and database, alongside specific stack environments. This provides you with the crucial information needed for seamless integration into your preferred frameworks and programming environments.
Pricing Tiers
Related Cloud Hub Solutions
Explore Related Blogs to Enhance Your Knowledge
Explore Scrums.com Products
Scrums.com Dedicated
Build a custom team that works exclusively on your project, fully integrated into your processes. You control the team composition, while we handle the logistics and infrastructure.
Scrums.com Product Development as a Service
Turnkey agile teams delivering production-ready features. Ideal for building new products with no tech stack preference. Cost-efficient, scalable, and results-driven.
Scrums.com On-Demand
Solve tech challenges fast with services like prototyping or code audits. Flexible, low-risk, and tailored to deliver results in weeks not months.
Scrums.com Augmented
Scale quickly with pre-vetted talent integrated into your team. Perfect for filling roles or building offshore development centers efficiently.
Scrums.com Developer Analytics
Track DevOps performance with real-time insights. Boost deployment speed, reduce downtime, and improve efficiency through actionable data and metrics.
Scrums.com Managed Services
Optimize platform performance with SLA-based support for Platform Maintenance, QA, cloud management, and more. Reliable, scalable, and designed to streamline your operations.