in reply to pdf::api2 page question

Umm .. Knowing that you have n pages, go back and iterate over the pages, adding Page m of n at the bottom of each page?

Alex / talexb / Toronto

"Groklaw is the open-source mentality applied to legal research" ~ Linus Torvalds

Replies are listed 'Best First'.
Re^2: pdf::api2 page question
by donarb (Beadle) on Oct 03, 2005 at 06:32 UTC
    For pages that I generate, my data is pre-processed from a database into an array of hashes. So each slot in the array is a page. No need to go back and place page numbers, just get the total page count from $#data, and then increment the current page number using a variable within the loop. This method may not work very well though if you are generating thousands of pages per document.
      thanks for the advice. i ended up making an array of pages and then at the end i cycled through the array and numbered the pages based on $pdf->pages; so i had something like $elementNumber of $pdf->pages; at the top of each page. i guess what i was trying to figure out is if this couldn't be done through the pdf object. i figured that every time a page object was created $pdf->page; the page would be put on a list owned by the pdf instance -- yeah totally goofy don't know what i was thinking...
        This method may not work very well though if you are generating thousands of pages per document.

      Why not?

      Alex / talexb / Toronto

      "Groklaw is the open-source mentality applied to legal research" ~ Linus Torvalds

        Because you would have all of your document's pages loaded into memory. That may not be the ideal situation depending on your machine's available memory. Not a big deal really, just something to consider.