Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

is it possible to read the text in a pdf file using perl?

Tags:

perl

I want to parse the text from a pdf file in perl without converting the pdf into any other format . Is it possible ?

like image 570
Hick Avatar asked Jan 30 '26 05:01

Hick


1 Answers

Yes you can.

Take a look at the CAM::PDF package.

You can use this module to pull the text out.

 my $pdf = CAM::PDF->new($filename);
 my $pageone_tree = $pdf->getPageContentTree(1);
 print CAM::PDF::PageText->render($pageone_tree);
like image 163
Byron Whitlock Avatar answered Jan 31 '26 21:01

Byron Whitlock