Export Web Page to PDF
An example request that uses Gaffa to convert an HTML page to a PDF. There are lots of HMTL to PDF API's but Gaffa handles it easily, as well as doing much more.
The following example is a request we've prebuilt to show you Gaffa's capabilities on our demo site. You can run this request right now in the Gaffa API Playground.
Gaffa's print-to-PDF feature allows you to easily export web pages as PDF files. Unlike the standard "Print to PDF" in your local browser, Gaffa's feature waits for specific items to load, uses proxies, and scales with your product's growth. Enhance your customer experience and streamline your PDF export process
API Request
The request below uses the POST endpoint to open the demo site on the table page, wait for the table to load, and then print the webpage to a PDF in A4 size with a 20-point margin and in portrait orientation.
{
"url": "https://demo.gaffa.dev/simulate/table?loadTime=3&rowCount=20",
"proxy_location": null,
"async": false,
"max_cache_age": 0,
"settings": {
"record_request": false,
"actions": [
{
"type": "wait",
"selector": "table"
},
{
"type": "print",
"size": "A4",
"margin": 20,
"orientation": "portrait"
}
]
}
}Actions
Read the full documentation for these actions here.
Response
Here's an example of the PDF returned by the request after the table has loaded.
Last updated