That could be due to the fact that PDF doesn't seem to be a widely-used module. If you really want to use that module, then after reading the thread, I'd suggest dumping a PDF that works and compare it to one that doesn't. Perhaps the problem is that one has a different encoding for the tags or some such.

If you don't mind switching to a different module, here's one that gets the information using PDF::API2:

#!/usr/bin/perl use strict; use warnings; use PDF::API2; use Data::Dumper; my $FName = shift // die "Missing filename!"; my $pdf = PDF::API2->open($FName) or die "Can't open PDF file $FName: +$!"; my %pdfinfo = $pdf->info; print "Author is: ", $pdfinfo{Author}, "\n"; print "Title is: ", $pdfinfo{Title}, "\n"; print "\n\nAll info tags:\n", Dumper(\%pdfinfo);

If I run it on the first handy PDF file on my desktop, I get:

Author is: Texas Instruments, Incorporated [SNAS033,D ] Title is: LM4873   Dual 2.1W Audio Amplifier Plus Stereo Headpho +ne Function (Rev. D) All info tags: $VAR1 = { 'ModDate' => 'D:20121201221441-06\'00\'', 'Subject' => 'Data Sheet', 'Creator' => 'TopLeaf 7.6.028', 'Title' => 'LM4873   Dual 2.1W Audio Amplifier Plus Ste +reo Headphone Function (Rev. D)', 'Keywords' => ', SNAS033,SNAS033D', 'CreationDate' => 'D:20121201221441-06\'00\'', 'Producer' => 'iText 2.1.7 by 1T3XT', 'Author' => 'Texas Instruments, Incorporated [SNAS033,D ]' };

...roboticus

When your only tool is a hammer, all problems look like your thumb.


In reply to Re^2: Retrieve the PDF file description by roboticus
in thread Retrieve the PDF file description by Punitha

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.