tags:

views:

222

answers:

1

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 to be displayed on the first page.

Right now, if I can add new page like this: $pdf->AddPage();

But, this put everything into the second page, whatever after this statement.

There seems no way to specify the page for either write or cell methods.

Rendering, and calculations are bit complex, thus don't want to store into a temp array and display after fully rendering the first page.

Thank you.

+2  A: 

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.

Chris Newman
Thank you. Lack of this feature is troublesome.
Natkeeran