How to convert HTML to a 4in x 6in PDF
To generate a PDF output from HTML with a size of 4in x 6in, you can control the output page size using the paperSize
parameter. Set the value of paperSize to 384px 576px
. Here is a sample HTTP request for generating the PDF output:
POST /v1/pdf/convert/from/html HTTP/1.1
Host: api.pdf.co
x-api-key: YOUR_API_KEY
Content-Type: application/json
Content-Length: 250
{
"html": "<h1>Hello World!</h1><a href='https://pdf.co'>Go to PDF.co</a>",
"name": "newDocument.pdf",
"mediaType": "print",
"margins": "0",
"paperSize": "384px 576px",
"orientation": "Portrait",
"printBackground": false
}
Zapier
You can also set the Page Size Override
field to 384px 576px
in the HTML to PDF Converter action in Zapier.
Integromat/Make
Or select Custom
under Paper Size
in the PDF.co Convert HTML to PDF module in Integromat/Make and enter 384px 576px
in the Size
field.