64 lines
2.5 KiB
Diff
64 lines
2.5 KiB
Diff
|
--- lib/Gscan2pdf/Tesseract.pm.orig
|
||
|
+++ lib/Gscan2pdf/Tesseract.pm
|
||
|
@@ -23,14 +23,14 @@
|
||
|
return $installed if $setup;
|
||
|
|
||
|
( undef, my $exe ) =
|
||
|
- Gscan2pdf::Document::exec_command( [ 'which', 'tesseract' ] );
|
||
|
+ Gscan2pdf::Document::exec_command( [ 'which', 'tesseract-ocr' ] );
|
||
|
return if ( not defined $exe or $exe eq $EMPTY );
|
||
|
$installed = 1;
|
||
|
|
||
|
# if we have 3.02.01 or better,
|
||
|
# we can use --list-langs and not bother with tessdata
|
||
|
( undef, my $out, my $err ) =
|
||
|
- Gscan2pdf::Document::exec_command( [ 'tesseract', '-v' ] );
|
||
|
+ Gscan2pdf::Document::exec_command( [ 'tesseract-ocr', '-v' ] );
|
||
|
if ( $err =~ /^tesseract[ ]([\d.]+)/xsm ) {
|
||
|
$version = $1;
|
||
|
}
|
||
|
@@ -44,7 +44,7 @@
|
||
|
}
|
||
|
|
||
|
( $out, $err ) =
|
||
|
- Gscan2pdf::Document::exec_command( ["tesseract '' '' -l ''"] );
|
||
|
+ Gscan2pdf::Document::exec_command( ["tesseract-ocr '' '' -l ''"] );
|
||
|
( $tessdata, $version, $datasuffix ) = parse_tessdata( $out . $err );
|
||
|
|
||
|
if ( not defined $tessdata ) {
|
||
|
@@ -162,7 +162,7 @@
|
||
|
if ( version->parse("v$version") > version->parse('v3.02') ) {
|
||
|
my ( undef, $out, $err ) =
|
||
|
Gscan2pdf::Document::exec_command(
|
||
|
- [ 'tesseract', '--list-langs' ] );
|
||
|
+ [ 'tesseract-ocr', '--list-langs' ] );
|
||
|
@codes = split /\n/xsm, $err ? $err : $out;
|
||
|
if ( $codes[0] =~ /^List[ ]of[ ]available[ ]languages/xsm ) {
|
||
|
shift @codes;
|
||
|
@@ -246,21 +246,21 @@
|
||
|
}
|
||
|
if ( version->parse("v$version") >= version->parse('v3.02.02') ) {
|
||
|
$cmd = [
|
||
|
- 'tesseract', $tif, $path . $name, '-l',
|
||
|
+ 'tesseract-ocr', $tif, $path . $name, '-l',
|
||
|
$options{language}, '-c', 'tessedit_create_hocr=1'
|
||
|
];
|
||
|
}
|
||
|
elsif ( version->parse("v$version") >= version->parse('v3') ) {
|
||
|
$cmd =
|
||
|
[
|
||
|
-"echo tessedit_create_hocr 1 > hocr.config;tesseract $tif $path$name -l $options{language} +hocr.config;rm hocr.config"
|
||
|
+"echo tessedit_create_hocr 1 > hocr.config;tesseract-ocr $tif $path$name -l $options{language} +hocr.config;rm hocr.config"
|
||
|
];
|
||
|
}
|
||
|
elsif ( $options{language} ) {
|
||
|
- $cmd = [ 'tesseract', $tif, $path . $name, '-l', $options{language} ];
|
||
|
+ $cmd = [ 'tesseract-ocr', $tif, $path . $name, '-l', $options{language} ];
|
||
|
}
|
||
|
else {
|
||
|
- $cmd = [ 'tesseract', $tif, $path . $name ];
|
||
|
+ $cmd = [ 'tesseract-ocr', $tif, $path . $name ];
|
||
|
}
|
||
|
|
||
|
my ( undef, $out, $err ) =
|