Mageia Bugzilla – Attachment 4093 Details for
Bug 10402
gscan2pdf: wrong encodging wih gocr and tesseract not seen
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
New Account
|
Forgot Password
[patch]
patch to fix gocr output and finding of tesseract version
gscan2pdf-gocr-output-and-tesseract-version.patch (text/plain), 1.36 KB, created by
Pablo Saratxaga
on 2013-06-02 22:38:04 CEST
(
hide
)
Description:
patch to fix gocr output and finding of tesseract version
Filename:
MIME Type:
Creator:
Pablo Saratxaga
Created:
2013-06-02 22:38:04 CEST
Size:
1.36 KB
patch
obsolete
>--- /usr/lib/perl5/vendor_perl/5.16.2/Gscan2pdf/Tesseract.pm_bak 2013-06-02 15:36:51.316070939 +0200 >+++ /usr/lib/perl5/vendor_perl/5.16.2/Gscan2pdf/Tesseract.pm 2013-06-02 22:21:27.398604139 +0200 >@@ -19,7 +19,7 @@ > return; > } > ( $tessdata, $version, $datasuffix ) = >- parse_tessdata(`tesseract '' '' -l '' 2>&1`); >+ parse_tessdata(`tesseract -v 2>&1 ; tesseract '' '' -l '' 2>&1`); > > if ( not defined($tessdata) ) { > if ( defined($version) and $version > 3.01 ) { >@@ -44,7 +44,8 @@ > my @output = @_; > my $output = join ",", @output; > my ( $v, $suffix ); >- $v = $1 + 0 if ( $output =~ /\ v(\d\.\d\d)\ /x ); >+ $v = $1 + 0 if ( $output =~ /^tesseract\ (\d\.\d\d)\.\d+/x ); >+ $v = $1 + 0 if (!$v && $output =~ /\ v(\d\.\d\d)\ /x ); > while ( $output =~ /\n/x ) { > $output =~ s/\n.*$//gx; > } >--- /usr/lib/perl5/vendor_perl/5.16.2/Gscan2pdf.pm_bak 2013-06-02 21:51:25.326366002 +0200 >+++ /usr/lib/perl5/vendor_perl/5.16.2/Gscan2pdf.pm 2013-06-02 22:05:11.925765974 +0200 >@@ -1267,9 +1267,12 @@ > > my $new = $page->clone; > >- my $cmd = "gocr $pnm"; >+ my $txt = File::Temp->new( SUFFIX => '.txt' ); >+ my $cmd = "gocr -o $txt $pnm"; > $logger->info($cmd); >- $new->{hocr} = `echo $$ > $pidfile;$cmd`; >+ $cmd = "echo $$ > $pidfile;$cmd"; >+ system($cmd); >+ $new->{hocr} = Gscan2pdf::slurp($txt); > return if $_self->{cancel}; > $new->{ocr_flag} = 1; #FlagOCR > $new->{ocr_time} =
--- /usr/lib/perl5/vendor_perl/5.16.2/Gscan2pdf/Tesseract.pm_bak 2013-06-02 15:36:51.316070939 +0200 +++ /usr/lib/perl5/vendor_perl/5.16.2/Gscan2pdf/Tesseract.pm 2013-06-02 22:21:27.398604139 +0200 @@ -19,7 +19,7 @@ return; } ( $tessdata, $version, $datasuffix ) = - parse_tessdata(`tesseract '' '' -l '' 2>&1`); + parse_tessdata(`tesseract -v 2>&1 ; tesseract '' '' -l '' 2>&1`); if ( not defined($tessdata) ) { if ( defined($version) and $version > 3.01 ) { @@ -44,7 +44,8 @@ my @output = @_; my $output = join ",", @output; my ( $v, $suffix ); - $v = $1 + 0 if ( $output =~ /\ v(\d\.\d\d)\ /x ); + $v = $1 + 0 if ( $output =~ /^tesseract\ (\d\.\d\d)\.\d+/x ); + $v = $1 + 0 if (!$v && $output =~ /\ v(\d\.\d\d)\ /x ); while ( $output =~ /\n/x ) { $output =~ s/\n.*$//gx; } --- /usr/lib/perl5/vendor_perl/5.16.2/Gscan2pdf.pm_bak 2013-06-02 21:51:25.326366002 +0200 +++ /usr/lib/perl5/vendor_perl/5.16.2/Gscan2pdf.pm 2013-06-02 22:05:11.925765974 +0200 @@ -1267,9 +1267,12 @@ my $new = $page->clone; - my $cmd = "gocr $pnm"; + my $txt = File::Temp->new( SUFFIX => '.txt' ); + my $cmd = "gocr -o $txt $pnm"; $logger->info($cmd); - $new->{hocr} = `echo $$ > $pidfile;$cmd`; + $cmd = "echo $$ > $pidfile;$cmd"; + system($cmd); + $new->{hocr} = Gscan2pdf::slurp($txt); return if $_self->{cancel}; $new->{ocr_flag} = 1; #FlagOCR $new->{ocr_time} =
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 10402
:
4093
|
4096
|
4166
|
4169
|
4191
|
4192