Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Comment on

( #3333=superdoc: print w/ replies, xml ) Need Help??
Hi Punitha,

I tested this code firstly with a PDF file I knew had the information you are looking for, and your script ran properly, printing the expected results. Then I created a document using Open Office Writer, exported it to PDF (In the 'PDF Options' tab I unchecked the 'Tagged PDF' and 'Export Notes' options) and experienced the errors you mention.
Use of uninitialized value in concatenation (.) or string at pdf.pl li +ne 9. Use of uninitialized value in concatenation (.) or string at pdf.pl li +ne 9. 1.4

Then I opened the PDF and displayed the 'Document Properties', only the PDF version and Producer tags have values, hence the 1.4 printing out. I think then that you can assume your problem occurs when these values are not populated either in the source document before conversion, or later in Acrobat writer.
If you want to catch these errors take a look at this basic example:
#!/usr/bin/perl use strict; use warnings; use PDF; my $pdf = PDF->new("003.pdf"); my $version = $pdf->Version; my $title = $pdf->GetInfo("Title"); my $author = $pdf->GetInfo("Author"); if ($version){ print "\nVersion: $version"; }else{ print "\nVersion: Undefined"; } if ($title){ print "\nTitle: $title"; }else{ print "\nTitle: Undefined"; } if ($author){ print "\nAuthor: $author\n"; }else{ print "\nAuthor: Undefined\n"; }


Hope this helps.

Martin

In reply to Re: Retrieve the PDF file description by marto
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!
  • 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, 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, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • Outside of code tags, you may need to use entities for some characters:
            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.
  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others romping around the Monastery: (6)
    As of 2014-12-28 11:18 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      Is guessing a good strategy for surviving in the IT business?





      Results (180 votes), past polls