Last active
May 8, 2024 22:37
-
-
Save jacksenechal/53dbf568438b212e7886b168ea4221c3 to your computer and use it in GitHub Desktop.
Gnome simple-scan post processing script to run OCR with ocrmypdf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# ocr-script.sh | |
# | |
# Useage: set this file as the post-processing script in the simple-scan preferences. No extra arguments needed. | |
# | |
# Requirements: | |
# - simple-scan | |
# - ocrmypdf | |
# | |
# For reference, at the time of writing the arguments from simple-scan are: | |
# $1 - the mime type, eg application/pdf | |
# $2 - unknown boolean | |
# $3 - the filename | |
# $4..N - postprocessing script arguments entered in preferences | |
filename=$3 | |
/usr/bin/ocrmypdf --deskew --clean --force-ocr "$filename" "$filename" &> /tmp/ocr.log | |
if [ $? -ne 0 ]; then | |
notify-send "OCR failed. See /tmp/ocr.log" | |
exit 1 | |
fi | |
notify-send "OCR complete" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment