Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight

Get Page No. in PDF File

by gopalr (Priest)
on Feb 13, 2006 at 04:29 UTC ( [id://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?
A reply falls below the community's threshold of quality. You may see it by logging in.