PDF File Information thru PERL

A

Aqua

Hello Group,

I am posting this question to both perl and PDF Groups.

I would like to get all the information about a PDF file. I dont want
to modidy ot create a PDF file. Information like PDF Version, Total
Pages, if possible total images, if it is bookmarked etc.
In this regard I am trying various modules like PDF (PDF::parse,
PDF::Core) and PDF::API2. The first module work fine but not on all
PDF files. The second one, actually I dont know how to get information
without modifying the PDF.

I would appreciate any pointers in this regard.

Thank You
Dominic
 
B

Bill

Aqua said:
I would like to get all the information about a PDF file. I dont want
to modidy ot create a PDF file. Information like PDF Version, Total
Pages, if possible total images, if it is bookmarked etc.
In this regard I am trying various modules like PDF (PDF::parse,
PDF::Core) and PDF::API2. The first module work fine but not on all
PDF files. The second one, actually I dont know how to get information
without modifying the PDF.

Why do you think have to modify the PDF with API2? I can use this on a
read-only file:

==============================
use strict;
use warnings;
use PDF::API2;

my $pf = 'mypdffile.pdf';
my $pdf = PDF::API2->open($pf) or die $!;
print "Starting analysis of $pf...\n";
my $pagenumber = $pdf->pages;
print "$pagenumber pages.\n";
my %opts = $pdf->info;
while (my ($k, $v) = each %opts) { print "option $k is: $v\n" }

I think there is other PDF info that can be dug out of the module as
well.

--Bill
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,236
Members
46,825
Latest member
VernonQuy6

Latest Threads

Top