Compare commits

..
Author SHA1 Message Date
fritz-hh b403016d5b Release notes updated for v2.1-stable 2014-09-20 19:50:32 +02:00
fritz-hh 5a81823969 Merge pull request #82 from orbitcowboy/v2.x
Fixed typo
2014-09-20 19:02:33 +02:00
fritz-hh 17801401cd Merge pull request #83 from DorianScholz/v2.x
- small changes to make this work on Ubuntu 12.04 called via symlink
- lowered minimum parallel version
2014-09-20 18:59:57 +02:00
Dorian Scholz 5c7b2a2a36 lowered minimum version for parallel to 20121122 2014-09-10 13:27:59 +02:00
Dorian Scholz 1db06de287 added BASEPATH to allow for execution via symlink 2014-09-10 13:26:14 +02:00
Martin Ettl 3904178d44 Fixed typo 2014-09-09 07:01:04 +02:00
fritz-hh 8bb9c3610c Merge pull request #81 from MoritzFago/v2.x
fixed tipo ghostcript to ghostscript
2014-09-08 18:31:00 +02:00
MoritzFago 7dcc382ccc fixed tipo ghostcript to ghostscript 2014-09-08 16:52:49 +02:00
fritz-hh b71fc807d2 Merge pull request #77 from andysigner/v2.x
Fixed typo in help text
2014-05-23 19:51:20 +02:00
Andy Signer 15d28d970a Fixed typo in help text 2014-05-23 12:41:31 +02:00
fritz-hh e083a860e9 Merge pull request #73 from andreas-christ/v2.x
Fixed typo in import of reportlab.
2014-04-27 23:20:48 +02:00
Andreas Christ 6463b9dd84 Fixed typo in import of reportlab. 2014-04-27 19:15:46 +02:00
fritz-hh c873de6ca4 Consider that the hocr file has not always the same name
Closes #72
2014-04-27 16:01:11 +02:00
fritz-hh b70863b47e support both older and newer versions of reportlab
closes #71
2014-04-27 15:53:20 +02:00
fritz-hh 3546f84c6d ignore *.pyc files 2014-04-27 15:46:55 +02:00
6 changed files with 62 additions and 13 deletions
+2 -1
View File
@@ -1,2 +1,3 @@
tmp/
log/
log/
*.pyc
Regular → Executable
+7 -6
View File
@@ -4,7 +4,8 @@
##############################################################################
# Import required scripts
. "`dirname $0`/src/config.sh"
BASEPATH="$(dirname $(readlink -f $0))"
. "$BASEPATH/src/config.sh"
# Set variables corresponding to the input parameters
ARGUMENTS="$@"
@@ -39,7 +40,7 @@ Usage: OCRmyPDF.sh [-h] [-v] [-g] [-k] [-d] [-c] [-i] [-o dpi] [-f] [-l languag
an oversampled image having the latter dpi value. This can improve the OCR results but can lead to a larger output PDF file.
(default: no oversampling performed)
-f : Force to OCR the whole document, even if some page already contain font data
(which should not be the case for PDF files built from scnanned images)
(which should not be the case for PDF files built from scanned images)
-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)
Multiple languages may be specified, separated by '+' characters.
@@ -128,7 +129,7 @@ FILE_OUTPUT_PDFA="`absolutePath "$2"`"
# set script path as working directory
cd "`dirname $0`"
cd "$BASEPATH"
[ $VERBOSITY -ge $LOG_DEBUG ] && echo "$TOOLNAME version: $VERSION"
[ $VERBOSITY -ge $LOG_DEBUG ] && echo "Arguments: $ARGUMENTS"
@@ -145,7 +146,7 @@ cd "`dirname $0`"
! command -v python2 > /dev/null && echo "Please install python v2.x. Exiting..." && exit $EXIT_MISSING_DEPENDENCY
! python2 -c 'import lxml' 2>/dev/null && echo "Please install the python library lxml. Exiting..." && exit $EXIT_MISSING_DEPENDENCY
! python2 -c 'import reportlab' 2>/dev/null && echo "Please install the python library reportlab. Exiting..." && exit $EXIT_MISSING_DEPENDENCY
! command -v gs > /dev/null && echo "Please install ghostcript. Exiting..." && exit $EXIT_MISSING_DEPENDENCY
! command -v gs > /dev/null && echo "Please install ghostscript. Exiting..." && exit $EXIT_MISSING_DEPENDENCY
! command -v java > /dev/null && echo "Please install java. Exiting..." && exit $EXIT_MISSING_DEPENDENCY
@@ -162,7 +163,7 @@ tesstooold=$(echo "`echo $tessversion | sed s/[.]//2`-`echo $reqtessversion | se
# ensure the right GNU parallel version is installed
# older version do not support -q flag (required to escape special characters)
reqparallelversion="20130222"
reqparallelversion="20121122"
parallelversion=`parallel --minversion 0`
! parallel --minversion "$reqparallelversion" > /dev/null \
&& echo "Please install GNU parallel ${reqparallelversion} or newer (currently installed version is ${parallelversion})" && exit $EXIT_MISSING_DEPENDENCY
@@ -292,4 +293,4 @@ END=`date +%s`
[ $VERBOSITY -ge $LOG_DEBUG ] && echo "Script took $(($END-$START)) seconds"
[ $pdf_valid -ne 1 ] && exit $EXIT_INVALID_OUPUT_PDFA || exit 0
[ $pdf_valid -ne 1 ] && exit $EXIT_INVALID_OUTPUT_PDFA || exit 0
+36
View File
@@ -5,6 +5,42 @@ Please always read this file before installing the package
Download software here: https://github.com/fritz-hh/OCRmyPDF/tags
v2.1-stable (2014-09-20):
=======
New features
------------
- None
Changes
-------
- None
Fixes
-----
- Allow execution via simlink
- Add support for tesseract 3.03
- Add support for newer version of reportlab
- Lowered minimum version of gnu parallel
- Various typo
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-stable (2014-01-25):
=======
+2 -2
View File
@@ -9,13 +9,13 @@ DEFAULT_DPI=300 # dpi value used as fall back if the page dpi cannot be deter
#####################################################################################
TOOLNAME="OCRmyPDF"
VERSION="v2.0-stable"
VERSION="v2.1-stable"
# possible exit codes
EXIT_BAD_ARGS="1"
EXIT_BAD_INPUT_FILE="2"
EXIT_MISSING_DEPENDENCY="3"
EXIT_INVALID_OUPUT_PDFA="4"
EXIT_INVALID_OUTPUT_PDFA="4"
EXIT_FILE_ACCESS_ERROR="5"
EXIT_OTHER_ERROR="15"
+7 -3
View File
@@ -14,7 +14,6 @@ from PIL import Image
import re, sys
import argparse
def monkeypatch_method(cls):
'''
Override a class method at runtime.
@@ -47,8 +46,13 @@ def PIL_imagedata(self):
from reportlab.lib.utils import import_zlib
from reportlab import rl_config
from reportlab.pdfbase.pdfutils import _AsciiBase85Encode, _chunker
from reportlab.pdfbase.pdfutils import _chunker
# in order to support both newer and older versions of reportlab
try:
from reportlab.pdfbase.pdfutils import _AsciiBase85Encode
except ImportError:
from reportlab.pdfbase.pdfutils import asciiBase85Encode as _AsciiBase85Encode
self.source = 'PIL'
zlib = import_zlib()
if not zlib:
+8 -1
View File
@@ -187,7 +187,14 @@ fi
[ $VERBOSITY -ge $LOG_DEBUG ] && echo "Page $page: Performing OCR"
! tesseract -l "$LAN" "$curImgPixmapClean" "$curHocr" hocr $TESS_CFG_FILES 1> /dev/null 2> /dev/null \
&& echo "Could not OCR file \"$curImgPixmapClean\". Exiting..." && exit $EXIT_OTHER_ERROR
mv "$curHocr.html" "$curHocr"
# Tesseract names the output files differently in some distributions.
if [ -e "$curHocr.html" ]; then
mv "$curHocr.html" "$curHocr"
elif [ -e "$curHocr.hocr" ]; then
mv "$curHocr.hocr" "$curHocr"
elif [ ! -e "$curHocr" ]; then
echo "\"$curHocr[.html|.hocr]\" not found. Exiting..." && exit $EXIT_OTHER_ERROR
fi
# embed text and image to new pdf file
if [ "$PREPROCESS_CLEANTOPDF" -eq "1" ]; then