Quick-Start

This commit is contained in:
Sven Velt 2021-01-05 12:27:19 +01:00
parent d0f8136aed
commit 554425bd25
3 changed files with 37 additions and 1 deletions

View file

@ -1,3 +1,20 @@
# Scan2PDF # Scan2PDF
Kleine Sammlung, um aus einem Scan (TIFF) ein Sandwich-PDF zu machen. Kleine Sammlung, um aus einem Scan (TIFF) ein Sandwich-PDF zu machen.
## Benötigte Pakete
```
# dpkg -l \*tesseract\* \*incron\* | grep "^ii"
ii incron 0.5.12-1+deb10u1 amd64 cron-like daemon which handles filesystem events
ii libtesseract4:amd64 4.0.0-2 amd64 Tesseract OCR library
ii tesseract-ocr 4.0.0-2 amd64 Tesseract command line OCR tool
ii tesseract-ocr-deu 1:4.00~git30-7274cfa-1 all tesseract-ocr language files for German
ii tesseract-ocr-eng 1:4.00~git30-7274cfa-1 all tesseract-ocr language files for English
ii tesseract-ocr-osd 1:4.00~git30-7274cfa-1 all tesseract-ocr language files for script and orientation
```
## incron
Mit `incrontab -e` (als User "scanner") kann festgelegt werden, wann was passieren soll - abhängig von Dateisystem-Operationen. Ein Beispiel findet sich in `incrond.txt`.

2
incrond.txt Normal file
View file

@ -0,0 +1,2 @@
/home/scanner/FTP IN_CLOSE_WRITE /home/scanner/bin/sandwich_pdf.sh $@/$#

17
sandwich_pdf.sh Executable file
View file

@ -0,0 +1,17 @@
#!/bin/bash
if [ -z "$1" ]; then
echo Bitte Dateinamen als Argument übergeben!
exit 1
fi
while [ -n "$1" ]; do
FF=$1
if echo "${FF}" | grep -q '\.tif$'; then
tesseract -l deu ${FF} ${FF/.tif/} pdf
else
echo "Skipped: $FF"
fi
shift
done