Dynamic Page Break in Printformat

Hi,

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?

Thanks!

Good evening,
Scroll down to the last section of this, it will help you a lot.

2 Likes

Will try that. Thank you!

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.

1 Like

I want to print those Invoice Details to be printed on everypage without including them into the header or letterhead.
Is this possible?

It would be also nice, if I could define a different display styling for all pages but the first one

image