kiz has asked for the wisdom of the Perl Monks concerning the following question:
using the following snippit of code:*File: Bathgate_ASRs.pdf Author ->Bob Webster CreationDate ->D:20060817180621+01'00' Creator ->Writer Producer ->OpenOffice.org 2.0 Title ->COMPETITIVE SAFARI MD5 Checksum: 18221baccb3c49a73dc9772302897e50 Size: ~169 KB (173585)
sub check_file { my $file = shift; my $pdf = PDF::API2->open($file); my %info = $pdf->info; print "\n*File: $filename\n"; foreach my $key (sort keys %info) { print "$key ->"; print narrow_char($info{$key}); print "\n"; } open (FILE, $file); binmode(FILE); print "MD5 Checksum: ",Digest::MD5->new->addfile(*FILE)->hexdigest, +"\n"; close(FILE); my $size = (stat("$file"))[7]; my $orig_size = $size; if ($size < 1024) { print "Size: $size bytes\n"; $size = undef; } if ($size) { $size = int($size / 1024); if ($size && $size < 1024) { print "Size: ~$size KB ($orig_size)\n"; $size = undef; } } if ($size) { $size = int($size / 1024); print "Size: ~$size MB ($orig_size)\n"; } }
What I now want find out two more things: the version of the pdf format, and the number of pages in the document... anyone got any hints?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Getting details from pdf files..
by prasadbabu (Prior) on Oct 05, 2006 at 10:15 UTC | |
|
Re: Getting details from pdf files..
by Samy_rio (Vicar) on Oct 05, 2006 at 10:17 UTC | |
|
Re: Getting details from pdf files..
by stvn (Monsignor) on Oct 05, 2006 at 12:06 UTC | |
|
Re: Getting details from pdf files..
by marto (Cardinal) on Oct 05, 2006 at 17:58 UTC |