Fujitsu ScanSnap: Difference between revisions
No edit summary |
|||
Line 120: | Line 120: | ||
while true | while true | ||
do | do | ||
FILE_TO_PROCESS=$(ls -1 -t | head -1) | FILE_TO_PROCESS=$(ls -1 -t *.pdf | head -1) | ||
if [[ $FILE_TO_PROCESS | if [[ -z $FILE_TO_PROCESS ]]; then | ||
echo "no files found" | echo "no files found" | ||
sleep 15 | sleep 15 | ||
Line 128: | Line 128: | ||
echo "-----> processing : "$FILE_TO_PROCESS | echo "-----> processing : "$FILE_TO_PROCESS | ||
ocrmypdf --output-type 'pdfa' \ | ocrmypdf --output-type 'pdfa' \ | ||
--rotate-pages --deskew --clean-final --optimize 3 \ | --rotate-pages --deskew --clean-final --optimize 3 \ | ||
Line 134: | Line 133: | ||
$FILE_TO_PROCESS $OUT_DIR/$FILE_TO_PROCESS | $FILE_TO_PROCESS $OUT_DIR/$FILE_TO_PROCESS | ||
sleep | if [[ -f "$OUT_DIR/$FILE_TO_PROCESS" ]]; then | ||
echo "ocr file was successfully created, deleting input file" | |||
rm $FILE_TO_PROCESS | |||
fi | |||
sleep 5 | |||
done | done | ||
</pre> | </pre> |
Revision as of 10:03, 4 July 2020
Prepare Raspberry OS
apt update apt full-upgrade apt install aptitude sane-utils img2pdf
- set /tmp to ram in /etc/fstab:
tmpfs /tmp tmpfs defaults,noatime,nosuid 0 0
Test Scanner Connection
lsusb sane-find-scanner scanimage -L
Scan Button Daemon
- Install via apt:
apt install scanbd
- change /etc/scanbd/dll.conf to fix kernel message:
#canon_pp fujitsu plustek_pp
- Test:
systemctl -t service tail -F /var/log/syslog
- /etc/scanbd/scanbd.conf
action scan { filter = "^scan.*" numerical-trigger { from-value = 1 to-value = 0 } desc = "Scan to file" script = "/srv/scanbd/scan.script" include(scanner.d/fujitsu.conf)
- /srv/scanbd/scan.script
#!/bin/bash TMP_DIR=$(mktemp -d) OUT_DIR=/srv/scanfolder_combined TIMESTAMP=$(date +%Y-%m-%d_%H-%M-%S) cd $TMP_DIR scanimage --batch="$TMP_DIR/scan_%03d.tiff" --format=tiff \ --resolution 300 --mode color --source "ADF Duplex" \ --brightness 25 --contrast 15 \ --page-width 210 --page-height 297 -x 210 -y 297 \ --device-name='fujitsu:ScanSnap S1500:74986' # --mode gray | color echo "convert to pdf..." img2pdf --pagesize A4 *.tiff --output ${OUT_DIR}/${TIMESTAMP}.pdf rm *.tiff
Testing manual scans
- disable scanbd to test manual scanning
systemctl stop scanbd
- simple scan
scanimage --batch="/srv/scan_%03d.pnm" --format=pnm --resolution 300 --mode Color --source "ADF Duplex"
OCRmyPDF via pip3
- install
sudo apt install ghostscript libxml2 tesseract-ocr tesseract-ocr-eng tesseract-ocr-deu pngquant unpaper leptonica-progs libleptonica-dev automake libtool zlib1g-dev libjpeg-dev python3 python3-pip libxml2-dev libxslt1-dev libffi-dev git git clone https://github.com/agl/jbig2enc cd jbig2enc ./autogen.sh ./configure && make sudo make install cd .. git clone https://github.com/qpdf/qpdf cd qpdf ./configure && make sudo make install sudo ldconfig cd .. sudo pip3 install --upgrade pip sudo pip3 install pybind11 sudo pip3 install ocrmypdf
- processing pdf files that appear in folder
- /srv/ocr_daemon.sh:
#!/bin/bash IN_DIR=/srv/scanfolder_combined OUT_DIR=/srv/scanfolder_ocred cd $IN_DIR while true do FILE_TO_PROCESS=$(ls -1 -t *.pdf | head -1) if [[ -z $FILE_TO_PROCESS ]]; then echo "no files found" sleep 15 continue fi echo "-----> processing : "$FILE_TO_PROCESS ocrmypdf --output-type 'pdfa' \ --rotate-pages --deskew --clean-final --optimize 3 \ --language 'deu+eng' \ $FILE_TO_PROCESS $OUT_DIR/$FILE_TO_PROCESS if [[ -f "$OUT_DIR/$FILE_TO_PROCESS" ]]; then echo "ocr file was successfully created, deleting input file" rm $FILE_TO_PROCESS fi sleep 5 done
Links
Troubleshooting Links
- https://bugs.launchpad.net/ubuntu/+source/scanbd/+bug/1747115
- User A
- /etc/dbus-1/system.d/scanbd_dbus.conf (user -> root)
- /lib/systemd/system/scanbm@.service (user -> root)
- /etc/scanbd/scanbd.conf (user -> root)
- User B
- /lib/udev/rules.d/99-saned.rules (ENV{libsane_matched}=="yes", GROUP="scanner")
- User A
Windows: Deactivate ScanSnap folder
- regsvr32 /u "C:\Program Files (x86)\PFU\ScanSnap\SSFolder\SSFolder.dll"