Compare commits

..
5 Commits
Author SHA1 Message Date
fritz-hh 1c34fd69cf RELEASE_NOTES update prior delivery of v2.0-stable 2014-01-25 22:14:05 +01:00
fritz-hh 4cf38404cc fixes #51
Allow tesseract 3.02.01 to be used.
Even 3.02.01 fails in few cases (see issue #28). I decided to allow this
version anyway because 3.02.02 is not yet available for some widespread
linux distributions
2014-01-25 21:58:50 +01:00
fritz-hh be830ddc31 List supported languages
In case lan is not supported, list the supported languages in the error
message
2014-01-18 22:22:19 +01:00
fritz-hh 18322b424f fixes #60
Check if the languages option provided to tesseract (-l) are supported
2014-01-18 21:38:22 +01:00
fritz-hh 6901c60db4 more robust way to check tesseract version
better way of checking if the tesseract version is compatible with the
script.
If the required tess version is 3.02.02, and the actual version is 3.03,
the script would have told before that the version is too old, because
303<30202, now it compares 3.03>3.0202
2014-01-18 21:02:15 +01:00
4 changed files with 57 additions and 10 deletions
+22 -7
View File
@@ -42,7 +42,7 @@ Usage: OCRmyPDF.sh [-h] [-v] [-g] [-k] [-d] [-c] [-i] [-o dpi] [-f] [-l languag
(which should not be the case for PDF files built from scnanned images) (which should not be the case for PDF files built from scnanned images)
-l : Set the language of the PDF file in order to improve OCR results (default "eng") -l : Set the language of the PDF file in order to improve OCR results (default "eng")
Any language supported by tesseract is supported (Tesseract uses 3-character ISO 639-2 language codes) Any language supported by tesseract is supported (Tesseract uses 3-character ISO 639-2 language codes)
Multiple languages may be specified, separated by plus characters. Multiple languages may be specified, separated by '+' characters.
-C : Pass an additional configuration file to the tesseract OCR engine. -C : Pass an additional configuration file to the tesseract OCR engine.
(this option can be used more than once) (this option can be used more than once)
Note 1: The configuration file must be available in the "tessdata/configs" folder of your tesseract installation Note 1: The configuration file must be available in the "tessdata/configs" folder of your tesseract installation
@@ -111,8 +111,7 @@ done
# Remove the optional arguments parsed above. # Remove the optional arguments parsed above.
shift $((OPTIND-1)) shift $((OPTIND-1))
# Check if the number of mandatory parameters # Check if the number of mandatory parameters provided is as expected
# provided is as expected
if [ "$#" -ne "2" ]; then if [ "$#" -ne "2" ]; then
echo "Exactly two mandatory argument shall be provided ($# arguments provided)" echo "Exactly two mandatory argument shall be provided ($# arguments provided)"
usage usage
@@ -150,12 +149,17 @@ cd "`dirname $0`"
! command -v java > /dev/null && echo "Please install java. Exiting..." && exit $EXIT_MISSING_DEPENDENCY ! command -v java > /dev/null && echo "Please install java. Exiting..." && exit $EXIT_MISSING_DEPENDENCY
# ensure the right tesseract version is installed # ensure the right tesseract version is installed
# older versions are known to produce malformed hocr output and should not be used # older versions are known to produce malformed hocr output and should not be used
reqtessversion="3.02.02" # Even 3.02.01 fails in few cases (see issue #28). I decided to allow this version anyway because
# 3.02.02 is not yet available for some widespread linux distributions
reqtessversion="3.02.01"
tessversion=`tesseract -v 2>&1 | grep "tesseract" | sed s/[^0-9.]//g` tessversion=`tesseract -v 2>&1 | grep "tesseract" | sed s/[^0-9.]//g`
! [ $((`echo $tessversion | sed s/[.]//g`-`echo $reqtessversion | sed s/[.]//g`)) -ge 0 ] > /dev/null \ tesstooold=$(echo "`echo $tessversion | sed s/[.]//2`-`echo $reqtessversion | sed s/[.]//2` < 0" | bc)
[ "$tesstooold" -eq "1" ] \
&& echo "Please install tesseract ${reqtessversion} or newer (currently installed version is ${tessversion})" && exit $EXIT_MISSING_DEPENDENCY && echo "Please install tesseract ${reqtessversion} or newer (currently installed version is ${tessversion})" && exit $EXIT_MISSING_DEPENDENCY
# ensure the right GNU parallel version is installed # ensure the right GNU parallel version is installed
# older version do not support -q flag (required to escape special characters) # older version do not support -q flag (required to escape special characters)
reqparallelversion="20130222" reqparallelversion="20130222"
@@ -163,11 +167,11 @@ parallelversion=`parallel --minversion 0`
! parallel --minversion "$reqparallelversion" > /dev/null \ ! parallel --minversion "$reqparallelversion" > /dev/null \
&& echo "Please install GNU parallel ${reqparallelversion} or newer (currently installed version is ${parallelversion})" && exit $EXIT_MISSING_DEPENDENCY && echo "Please install GNU parallel ${reqparallelversion} or newer (currently installed version is ${parallelversion})" && exit $EXIT_MISSING_DEPENDENCY
# ensure pdftoppm is provided by poppler-utils, not the older xpdf version # ensure pdftoppm is provided by poppler-utils, not the older xpdf version
! pdftoppm -v 2>&1 | grep -q 'Poppler' && echo "Please remove xpdf and install poppler-utils. Exiting..." && $EXIT_MISSING_DEPENDENCY ! pdftoppm -v 2>&1 | grep -q 'Poppler' && echo "Please remove xpdf and install poppler-utils. Exiting..." && $EXIT_MISSING_DEPENDENCY
# Display the version of the tools if log level is LOG_DEBUG # Display the version of the tools if log level is LOG_DEBUG
if [ $VERBOSITY -ge $LOG_DEBUG ]; then if [ $VERBOSITY -ge $LOG_DEBUG ]; then
echo "--------------------------------" echo "--------------------------------"
@@ -201,8 +205,19 @@ fi
# Initialize path to temporary files using mktemp # check if the languages passed to tesseract are all supported
for currentlan in `echo "$LAN" | sed 's/+/ /g'`; do
if ! tesseract --list-langs 2>&1 | grep "^$currentlan\$" > /dev/null; then
echo "The language \"$currentlan\" is not supported by tesseract."
tesseract --list-langs 2>&1 | tr '\n' ' '; echo
echo "Exiting..."
exit $EXIT_BAD_ARGS
fi
done
# Initialize path to temporary files using mktemp
# Goal: save tmp file in a sub-folder of the $TMPDIR environment variable (or in "/tmp" if unset) # Goal: save tmp file in a sub-folder of the $TMPDIR environment variable (or in "/tmp" if unset)
# Unfortunately, Linux mktemp is not compatible with FreeBSD/OSX mktemp # Unfortunately, Linux mktemp is not compatible with FreeBSD/OSX mktemp
# Linux version requires no arg # Linux version requires no arg
+1 -1
View File
@@ -11,7 +11,7 @@ Main features
- Generates a searchable PDF/A file from a PDF file containing only images - Generates a searchable PDF/A file from a PDF file containing only images
- Places OCRed text accurately below the image to ease copy / paste - Places OCRed text accurately below the image to ease copy / paste
- Keeps the exact resolution of the original embedded images - Keeps the exact resolution of the original embedded images
- or if requested oversample the images before OCRing so as to get better results - or if requested oversamples the images before OCRing so as to get better results
- If requested deskews and / or clean the image before performing OCR - If requested deskews and / or clean the image before performing OCR
- Validates the generated file against the PDF/A specification using jhove - Validates the generated file against the PDF/A specification using jhove
- Provides debug mode to enable easy verification of the OCR results - Provides debug mode to enable easy verification of the OCR results
+32
View File
@@ -5,6 +5,38 @@ Please always read this file before installing the package
Download software here: https://github.com/fritz-hh/OCRmyPDF/tags Download software here: https://github.com/fritz-hh/OCRmyPDF/tags
v2.0-stable (2014-01-25):
=======
New features
------------
- Check if the language(s) passed using the -l option is supported by tesseract (fixes #60)
Changes
-------
- Allow OCRmyPDF to be used with tesseract 3.02.01, even though OCR might fail for few PDF file (see issue #28). Rationale: For some linux distribution, no newer version than tesseract 3.02.01 is available
Fixes
-----
- More robust algorithm for checking the version of the installed tesseract package
Tested with
-----------
- Operating system: FreeBSD 9.1
- Dependencies:
- parallel 20130222
- poppler-utils 0.22.2
- ImageMagick 6.8.0-7 2013-03-30
- Unpaper 0.3
- tesseract 3.02.02
- Python 2.7.3
- ghoscript (gs): 9.06
- java: openjdk version "1.7.0_17"
v2.0-rc2 (2014-01-16): v2.0-rc2 (2014-01-16):
======= =======
+1 -1
View File
@@ -9,7 +9,7 @@ DEFAULT_DPI=300 # dpi value used as fall back if the page dpi cannot be deter
##################################################################################### #####################################################################################
TOOLNAME="OCRmyPDF" TOOLNAME="OCRmyPDF"
VERSION="v2.0-rc2" VERSION="v2.0-stable"
# possible exit codes # possible exit codes
EXIT_BAD_ARGS="1" EXIT_BAD_ARGS="1"