Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW

Get Page No. in PDF File

by gopalr (Priest)
on Feb 13, 2006 at 04:29 UTC ( #529738=perlquestion: print w/replies, xml ) Need Help??
gopalr has asked for the wisdom of the Perl Monks concerning the following question:

Hi Monks,

PDF File Contains Page No as follows:

162(1 of 7) 163(2 of 7) 164(3 of 7) 165(4 of 7) 166(5 of 7) 167(6 of 7) 168(7 of 7)

I can get the PDF page number (i.e. 1 to 7) by using CAM::PDF Module.

my $doc = CAM::PDF->new($file) || die "$CAM::PDF::errstr\n"; my $pages = $doc->numPages();

Please advice me that how to get the actual page number i.e. 162 to 168.

Gopal R.

Replies are listed 'Best First'.
Re: Get Page No. in PDF File
by dragonchild (Archbishop) on Feb 13, 2006 at 15:35 UTC
    Using CAM::PDF, you can parse the document and find the string that corresponds to what you're looking for. As for how? I dunno. You might want to look at the source for Test::PDF which uses CAM::PDF to verify that two PDFs contain the same data and structure and see what stvn does there.

    My criteria for good software:
    1. Does it work?
    2. Can someone else come in, make a change, and be reasonably certain no bugs were introduced?
Re: Get Page No. in PDF File
by Nude Reaper (Initiate) on Feb 13, 2006 at 05:26 UTC

    Is it always this way? You could add 155 to the PDF number.


      No. The Page number may vary depends upon the file.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://529738]
Approved by Samy_rio
[Corion]: Mr. Muskrat: I'm not sure if it really happens more often, but I don't exactly know either
[LanX]: yep
[LanX]: more often for some weeks now
[Corion]: I think I'll have to manually (as god) intervene with that node, as the simple reparenting didn't seem to fix the parent/child relationship of the nodes
[Corion]: I think I have an idea but I'll have to open a ticket with on that - hopefully I get to that on the weekend
LanX imagines a burning thorn bush
[Mr. Muskrat]: Thank you!
[Mr. Muskrat]: Oh that is odd. I got the message that it was reparented but yeah, it didn't actually do it. lol
[Corion]: LanX: No, Co-Rion appears as Monkey God :-)
[Corion]: Mr. Muskrat: Yeah, that message is automatic when the "normal" reparenting is done, but I think some rows that make up the node were not added to the DB properly

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (11)
As of 2017-01-19 16:26 GMT
Find Nodes?
    Voting Booth?
    Do you watch meteor showers?

    Results (170 votes). Check out past polls.