I want to create a custom printformat. It is already setup, but I need a option for a dynamic pagebreak if the table reached the end of the printable space.
Unfortunately the positions for a specific customer can be multiple lines in a table row or singe line. So it would be hard to calculate how many rows could fit in one page.
Is there a solution for that or must I set a “hard” value for the page break?
Hey, so the easiest option would be to use the print format builder (the one from before Frappe V15).
Add a new print format, and after saving it click on the edit format.
Remove all the default fields populated, then add a new section with only a single custom html field.
Now write the code without any header and footer in that custom html field.
Use the letterhead selector in the preview screen of any print for the header and footer.
This will ensure the header and footer is repeated on every page and will also print a page number.
I’ve tried going the hard route of counting pages, item description character length and everything, but every character has a different length and thus in the long run any calculation of line lengths would only be approximations leading to misalignment.
Just use the standard print formats with your replaced custom html field to hold your jinja/html body.