Browser rendering /pdf endpoint. How to specify A4 format and margins?

I'm using this https://developers.cloudflare.com/browser-rendering/rest-api/pdf-endpoint/ via the TypeScript SDK. With Puppeteer you can specify formats and margins, but it doesn't seem that these parameters are exposed. It doesn't seem possible to print an A4 (for invoices, receipts, etc). Is there a workaround? If not, any plans to support them? Thanks!
Cloudflare Docs
/pdf - Render PDF
The /pdf endpoint instructs the browser to render the webpage as a PDF document.
2 Replies
Hard@Work
Hard@Work7mo ago
Would setting the viewport size work?
magoz
magozOP7mo ago
No, setting the viewport sets the browser window size (https://pptr.dev/api/puppeteer.page.setviewport), but saving the page as a PDF is not affected by the window size.

Did you find this page helpful?