Converts the PDF 'example.pdf' to plain text.
IIRC this only converts the first page of the document, but that can be changed by modifying the argument to getPageContentTree on line 8. Been a while since I've used this so ymmv.
- #!/perl/bin/perl -w
- use CAM::PDF;
- use CAM::PDF::PageText;
- $filename = "example.pdf";
- my $pdf = CAM::PDF->new($filename);
- my $pageone_tree = $pdf->getPageContentTree(4);
- print CAM::PDF::PageText->render($pageone_tree);
- #Note: I had to install CAM::PDF::PageText by hand, it was not installed by CPAN when I installed CAM::PDF.
You need to login to post a comment.