From 6d203e3eee87137220ca0275a95ad2b2973f9126 Mon Sep 17 00:00:00 2001 From: fritz-hh Date: Wed, 15 Jan 2014 21:19:20 +0100 Subject: [PATCH] portability improvements + minor changes --- src/ocrPage.sh | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/ocrPage.sh b/src/ocrPage.sh index 7f707285..04685641 100755 --- a/src/ocrPage.sh +++ b/src/ocrPage.sh @@ -37,6 +37,7 @@ FORCE_OCR="${14}" # Force to OCR, even if the page already contains fonts # Output: A file containing the characteristics of the embedded image. File structure: # DPI= # COLOR_SPACE= +# DEPTH= # Returns: # - 0: if no error occurs # - 1: in case the page already contains fonts (which should be the case for PDF generated from scanned pages) @@ -119,9 +120,9 @@ getImgInfo "$page" "$widthPDF" "$heightPDF" "$curImgInfo" ret_code="$?" # in case the page contains text do not OCR, unless the FORCE_OCR flag is set -if [ "$ret_code" -eq "1" -a "$FORCE_OCR" -eq "0" ]; then +if ([ "$ret_code" -eq "1" ] && [ "$FORCE_OCR" -eq "0" ]); then echo "Page $page: Exiting... (Use the -f option to force OCRing, even though fonts are available in the input file)" && exit $EXIT_BAD_INPUT_FILE -elif [ "$ret_code" -eq "1" -a "$FORCE_OCR" -eq "1" ]; then +elif ([ "$ret_code" -eq "1" ] && [ "$FORCE_OCR" -eq "1" ]); then [ $VERBOSITY -ge $LOG_WARN ] && echo "Page $page: OCRing anyway, assuming a default resolution of $dpi dpi" # in case the page contains more than one image, warn the user but go on with default parameters elif [ "$ret_code" -eq "2" ]; then @@ -208,7 +209,7 @@ fi # delete temporary files created for the current page # to avoid using to much disk space in case of PDF files having many pages if [ $KEEP_TMP -eq 0 ]; then - rm -f "$curOrigImg"*.* + rm -f "$curOrigImg"* rm -f "$curHocr" rm -f "$curImgPixmap" rm -f "$curImgPixmapDeskewed"