I like the answer PDF :: API2 from Sinan ΓnΓΌr. PDF :: API2 is awesome.
I am the author of CAM :: PDF. Sorry, I skipped this question before. CAM :: PDF comes with a cmdline tool for extracting such data (pdfinfo.pl).
My library does not officially support this, but it's easy to do if you don't mind hacking the insides.
#!perl -w use strict; use CAM::PDF; my $infile = shift || die 'syntax...'; my $pdf = CAM::PDF->new($infile) || die; my $info = $pdf->getValue($pdf->{trailer}->{Info}); if ($info) { for my $key (sort keys %{$info}) { my $value = $info->{$key}; if ($value->{type} eq 'string') { print "$key: $value->{value}\n"; } else { print "$key: <$value->{type}>\n"; } } }
source share