NAME
PDF::OCR2 - extract all text and all image ocr from pdf
SYNOPSIS
use PDF::OCR2;
my $p = PDF::OCR2->new('./path/to/file.pdf');
my $text_all = $p->text;
my @text_pages = $p->text;
DESCRIPTION
This is meant to replace PDF::OCR. The backend complexity of this process has been isolated in modules:
PDF::GetImages
PDF::Burst
Image::OCR::Tesseract
PDF::OCR2::Pages - in this distro.
Why not just modify PDF::OCR?? This is such a massive breakdown of code hierachy and interdependency, and such a different interface, that this made more sense. PDF::OCR was ok. But it was messy and really, this is a lot better.
METHODS
new()
Argument is path to pdf file.
text()
Takes no argument. In scalar context, returns text of all pages, joined with a pagebreak \f character. In list context, returns text of pages one per element.
CAVEATS
This only works on posix.
ERRORS
If you have errors with PDF::API2 saying the pdf is corrupt, likely via PDF::Burst.. Then try this:
use PDF::OCR2;
PDF::Burst::BURST_METHOD = 'CAM_PDF';
# and then...
my $pdf = PDF::OCR2->new('./pathtofile.pdf');
print $pdf->text;
CRIT AND SUGGESTIONS
The AUTHOR is open to any suggestions and requests.
SEE ALSO
CAM::PDF PDF::API2 PDF::GetImages PDF::Burst PDF::OCR2::Page
REPLACES
PDF::OCR - deprecated by this module.
AUTHOR
Leo Charre leocharre at cpan dot org
THANKS
COPYRIGHT
Copyright (c) 2009 Leo Charre. All rights reserved.
LICENSE
This package is free software; you can redistribute it and/or modify it under the same terms as Perl itself, i.e., under the terms of the "Artistic License" or the "GNU General Public License".
DISCLAIMER
This package is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the "GNU General Public License" for more details.