13 ms·
If so, then you have a full browser to generate your pdfs on. An approach I have used (more or less): - have a print.html template page - use iframe to render
by rudasn 3y ago
If so, then you have a full browser to generate your pdfs on. An approach I have used (more or less):
- have a print.html template page
- use iframe to render and load the page
- either on the print page, or from top frame, call window.print
You can use the aforementioned js libraries to generate footers and such, and use any print css. You can test the print layout in your dev tools, no need to wait for browser preview.
Note that browsers will try to render thead and tfooter elements on every page their parent table spans, that can be very useful.
At work we have a playwright container with express js waiting for incoming requests to load the print.html page and save it as pdf. We're also using volumes so that all data exchange happens in disk and not being passed around in http requests.
PDFs that took maybe 30 seconds with weasy print, now take 5 seconds.