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
FPDF doesn't allow you to go back to a previous page. Once you're done with a page - either by calling AddPage() or by running out of space when SetAutoPageBreak() is turned on - you're done with it.
The workaround is to generate your document without the total, write it to a temporary file then load it back (using FPDI: http://www.setasign.de/products/pdf-php-solutions/fpdi/) and add the total in the correct place.