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
I found very suitable the *str_replace* method, due to the need to write "n of m pages". First wrote the n number normally as I constructed every page and finally replaced the m cipher in $pdf->pages[$i] page by page.