50 lines
1.9 KiB
Diff
50 lines
1.9 KiB
Diff
--- a/lib/Gscan2pdf/Tesseract.pm 2021-07-02 20:26:05.063622498 +0200
|
|
+++ b/lib/Gscan2pdf/Tesseract.pm 2021-07-02 20:32:12.104791637 +0200
|
|
@@ -54,25 +54,25 @@
|
|
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;
|
|
|
|
# Only support 3.02.01 or better, so that
|
|
# 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;
|
|
}
|
|
elsif ( $out =~ /^tesseract[ ]([\d.]+)/xsm ) {
|
|
$version = $1;
|
|
}
|
|
if ( not $version ) { return }
|
|
if ( $version !~ /^\d+[.]\d+$/xsm ) { $version = 'v' . $version }
|
|
$version = version->parse($version);
|
|
if ( $version > version->parse('v3.02.00') ) {
|
|
- $logger->info("Found tesseract version $version.");
|
|
+ $logger->info("Found tesseract-ocr version $version.");
|
|
$setup = 1;
|
|
return $installed;
|
|
}
|
|
@@ -86,7 +86,7 @@
|
|
if ( not %languages ) {
|
|
my @codes;
|
|
my ( undef, $out ) =
|
|
- Gscan2pdf::Document::exec_command( [ 'tesseract', '--list-langs' ] );
|
|
+ Gscan2pdf::Document::exec_command( [ 'tesseract-ocr', '--list-langs' ] );
|
|
@codes = split /\n/xsm, $out;
|
|
if ( $codes[0] =~ /^List[ ]of[ ]available[ ]languages/xsm ) {
|
|
shift @codes;
|
|
@@ -99,7 +99,7 @@
|
|
if ( not defined $name ) {
|
|
$name = $code;
|
|
}
|
|
- $logger->info("Found tesseract language $code ($name)");
|
|
+ $logger->info("Found tesseract-ocr language $code ($name)");
|
|
$languages{$code} = $name;
|
|
}
|
|
}
|