For Programmers: Free Programming Magazines  


Home > Archive > PERL Beginners > August 2004 > Reading PDF documents with Perl









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Reading PDF documents with Perl
Dave Campbell

2004-08-30, 3:56 am

Hi all.

I'm new with perl and trying to get a script to read the 'Subject' field
out of a document using PDF::Parse and the following code:

#!/usr/bin/perl -w

use PDF::Parse;

open($pdf_file,"<067232489X.pdf") or die("Cannot open file!");

$pdf->TargetFile($pdf_file);
$pdf->LoadPageInfo;

$subject = $pdf->GetInfo("Subject");

print "The subect of file $pdf is:\n";
print $subject;


I'm not really sure if I've got much of anything right, but I'm getting
the following error trying to run this code:
PDF::Core::PDFGetPrimitive() called too early to check prototype at
D:/StudyPerl
/site/lib/PDF/Core.pm line 288.
PDF::Core::PDFGetPrimitive() called too early to check prototype at
D:/StudyPerl
/site/lib/PDF/Core.pm line 294.
Can't call method "TargetFile" on an undefined value at pdf_check.pl line 8.


Can anyone possibly help me figure out where I'm going wrong with this?

Thanks!
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com