http://www.perlmonks.org?node_id=546470

Punitha has asked for the wisdom of the Perl Monks concerning the following question:

Dear Monks,

I need to take PDF file description and validate it. I tried this,

use strict; use warnings; use PDF; my $pdf = PDF->new("0001.pdf"); my $version = $pdf->Version; my $title = $pdf->GetInfo("Title"); my $author = $pdf->GetInfo("Author"); print "$version\n$title\n$author\n";

Some of the PDF files, it works fine. For many PDF files it throws an error as:

Premature end of file reached at valid.pl line 5 Bad object reference '' at valid.pl line 5 Bad object reference '' at valid.pl line 5 Bad object reference '' at valid.pl line 5 Use of uninitialized value in concatenation (.) or string at valid.pl +line 9. Use of uninitialized value in concatenation (.) or string at valid.pl +line 9. 1.6

I don't know why this is happening and how to rectify this. Can any one help me.

Thanks in advance.

Punitha