Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re^2: pdf::api2 page question

by donarb (Beadle)
on Oct 03, 2005 at 06:32 UTC ( #496828=note: print w/replies, xml ) Need Help??


in reply to Re: pdf::api2 page question
in thread pdf::api2 page question

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.

Replies are listed 'Best First'.
Re^3: pdf::api2 page question
by talexb (Chancellor) on Oct 03, 2005 at 15:08 UTC
      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.

        In that case you probably want to look into some sort of caching arrangement, where your pages are swapped to disk while you run through the document. Something like Cache would probably do the job nicely.

        Once you get to the end of the document, you can go back to the first page, add the "1 of 3456 pages" to the page, write that page out, flush that page from the cache, and continue to the end.

        Alex / talexb / Toronto

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

Re^3: pdf::api2 page question
by tonyperl (Initiate) on Oct 07, 2005 at 03:53 UTC
    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...

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://496828]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (6)
As of 2022-01-21 12:31 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    In 2022, my preferred method to securely store passwords is:












    Results (57 votes). Check out past polls.

    Notices?