We’ve noticed an inconsistent behavior with PDF formatting when using print formats in our application. When a print format is triggered manually, the PDF is correctly formatted with the CSS styles applied. However, when the same print format is triggered by background jobs, the PDF does not seem to incorporate the CSS styles as expected.
- Manual Trigger: When I manually trigger the print format, the PDF generated incorporates the CSS styles, resulting in a well-formatted document (screenshot will be attached).
- Background Job Trigger: However, when the print format is triggered by background jobs, the resulting PDF lacks the CSS styles, leading to an unformatted document (screenshot will be attached).
- Frappe Version: v12.17.0
Hi guys, Any help here? Thanks
How did you generate the pdf using the background job?
Did you give the same parameters as seen in the url for the manual pdf print?
Working with Print formats have been hell from my experience as well. Alignments issues when printing from different browsers, header and footer doesn’t align properly at the start and end of the pages, the content if greater than one page (this is for line item descriptions specifically) leaves empty spaces and overlaps the next/previous line items… (Sorry for the rant)
Generating pdf didn’t give me a consitent and beautiful results too. What i end up is using jinja to create my print templates with html. Now I’ve the ultimate flexiblity with css and to convert to print instead of generating pdfs i use print to pdf feature of chrome. That way i’ll be consistent with the pdf.
In browser prints, how do you ensure the header is repeated on every page? (And the footer too at the bottom of every page?)
For single page prints yeah it works fine.
If you are using flex. Then it is not working because of wkhtmltopdf library.
You can use following CSS for flex in your print formats.