I am generating pdf invoice using fpdf.
Some invoices containing many items, and details need to go into the second page. However, I need the total, and other details
Some clever solutions here, but I don't recommend this trickery, because it goes against the basic FPDF model and will sooner or later probably cause other problems down the road.
Programming is already complex enough!
So, separate the model of the invoice or whatever it is from the presentation. Construct the entire model. Then output the presentation (the PDF in this case).