You could do this using the
page_script() method which is a method of running a script per-page scripts after the document has fully rendered. It gives you access to all the variables you need to generate the desired output.
You would, of course, have to write some logic to determine how many pages get the footer. If you don't know how many pages need the footer in advance you could use a global variable to store a value indicating on what page to stop.
Probably the difficult aspect of this is writing code that writes code. I've mocked up a sample that I think captures what you want. You can find it here:
http://eclecticgeek.com/dompdf/debug.php?identifier=ed03c2020546641d3e830a7c0115c8aeYour
StackOverflow post indicated you wanted to avoid inline script if possible. Unfortunately it's not possible to generate what you want to generate without it right now. You could add the script via the $dompdf object rather than as inline script (
$dompdf->get_canvas()->page_script()). Then you could filter out any inline script/PHP from the user document.
On Tuesday, July 10, 2012 11:32:46 AM UTC-4, Alan wrote:
I have to produce a document in this situation:
page 1 <- in the footer: "page 1 of 3"
page 2 <- in the footer: "page 2 of 3"
page 3 <- in the footer: "page 3 of 3"
page 5 <- no page number
page 6 <- no page number
This is an example, the total pages can vary and also the first part of numbered pages.