bundlewrap/bundles/scansnap/files/scan.sh

19 lines
474 B
Bash
Raw Normal View History

#!/bin/bash
set -euo pipefail
DATE=$(date +%F_%H-%M-%S)
OUTFILE="/tmp/${DATE}"
scanimage --source 'ADF Duplex' --format tiff --mode Gray --resolution 300 --page-width 210 --page-height 297.3 -x 210 -y 297.3 --batch=${OUTFILE}_p%04d.tiff
convert ${OUTFILE}_*.tiff ${OUTFILE}.pdf
ocrmypdf -l deu ${OUTFILE}.pdf ${OUTFILE}.OCR.pdf
rm -f ${OUTFILE}_*.tiff
rm -f ${OUTFILE}.pdf
chown nobody:nogroup "${OUTFILE}.OCR.pdf"
mv "${OUTFILE}.OCR.pdf" "/srv/scansnap/${DATE}.pdf"