0

Hi im trying to extract the content of pdf file but im facing the above problem my code is

use PDF;

use CAM::PDF;

use CAM::PDF::PageText;

my $file = "s.pdf"; 
my $pdf = CAM::PDF->new($file); 
 my $pageone_tree = $pdf->getPageContent(1);
 print CAM::PDF::PageText->render($pageone_tree);

Im getting error " getPageContent(1)" here . what went wrong in my code

madth3
  • 7,275
  • 12
  • 50
  • 74
backtrack
  • 7,996
  • 5
  • 52
  • 99
  • Please keep in mind that CAM::PDF::PageText is just a crude heuristic! It's basically rendering the PDF in memory and looking at which characters end up close to each other. Don't expect it to produce quality output on arbitrary PDFs. – Chris Dolan Aug 22 '13 at 19:31
  • @ChrisDolan is there anyway to do it – backtrack Aug 23 '13 at 03:34

1 Answers1

0

Try out this

my $pageone_tree = $pdf->getPageContentTree($_);
Pandiyan Cool
  • 6,381
  • 8
  • 51
  • 87
  • Or just use `$pdf->getPageText($pagenum)` which is a convenience function to wrap the call to `getPageContentTree` and `CAM::PDF::PageText`. (I'm the CAM::PDF author) – Chris Dolan Aug 22 '13 at 19:28