Tuesday, April 28, 2009

Extract PDF information

the fast/best solution, for now. to get information from PDF file. require xpdf/pdfinfo. 
#!/usr/bin/perl
my $filename = "D:/project/mediu/pdf/html_docs.pdf";
$pdfinfo = "C:/Programs/pdf/xpdf/pdfinfo.exe"; #Extact info from pdf file 
$result = `$pdfinfo $filename`;
my @results = split(/\n/,$result);
foreach(@results){
my @varval = split(/\:/,$_);
$varval[1] =~ s/^\s+//;
print "$varval[0] = $varval[1]\n";
}
exit;

No comments: