Re: Pages numeration issue

261 views
Skip to first unread message

BrianS

unread,
Jul 17, 2012, 2:04:49 PM7/17/12
to dom...@googlegroups.com
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=ed03c2020546641d3e830a7c0115c8ae

Your 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.

Alan

unread,
Jul 18, 2012, 8:49:59 AM7/18/12
to dom...@googlegroups.com
Very thanks,
Now I have solved the problem creating two different PDF from two html document, 
after the creation I merge this two PDF in one and finish. But for do this I have used also other library. 

BrianS

unread,
Jan 8, 2013, 10:46:55 AM1/8/13
to dom...@googlegroups.com
That's a bit more difficult, but I have previously worked out a method here:
https://groups.google.com/d/topic/dompdf/2kqvKHY7wlk/discussion

On Tuesday, January 8, 2013 4:11:36 AM UTC-5, Hung Xuan wrote:
Thanks Alan. can you help me how to do that? i need create index/table of content in pdf.
Reply all
Reply to author
Forward
0 new messages