I'm wanting to get details from a pdf file. I can get the easy stuff:
*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)
using the following snippit of code:
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?



-- Ian Stuart
A man depriving some poor village, somewhere, of a first-class idiot.

In reply to Getting details from pdf files.. by kiz

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.