Network Scanner with Fujitsu ScanSnap and a Raspberry Pi

My trusty Fujitsu ScanSnap S1500 had to be tossed aside when MacOS Catalina ditched the 32bit libraries. It sat lifeless on my desk until I realized I could use a Raspberry Pi to bring it back to life as a headless network scanner.

Thinking through this…

If I could plug the ScanSnap into a Raspberry Pi, capture the scan button depressions on the device, get the scanned content converted to PDF and loaded to some shared drive it would be the perfect solution.

Solution Summary

Solution Walk-through

Here was my process to make the network scanner work! Everything lives in the pi user’s home directory/space and the Samba share runs from there as well. Trying keep it as KISS-focused as possible.

Software Install

Install all of the software necessary for the system:

sudo apt-get update
sudo apt-get upgrade
sudo apt install sane sane-utils scanbd git imagemagick -y

Scanner Check

We add the pi user into the scanner group and then we check to make sure the scanner is working after the SANE install. (before this step; put a piece of paper in the scanner and open her lid)

sudo usermod -a -G scanner pi
sudo scanimage >/tmp/out.pnm

now, /tmp/out.pnm will have the scan from the scanner

Scan App

There is a cool script made by Raman Gupta at https://github.com/rocketraman/sane-scan-pdf. Configuring all of the scanimage/scan calls can be time consuming; Raman has wrapped it all and I found it to be useful (minus an issue on RPI that I reported).

cd $HOME
git clone https://github.com/rocketraman/sane-scan-pdf.git

Create a shared space for the scans via Samba Share

We need a spot to keep the scans on the local system and share them out via SMB.

cd $HOME; mkdir scans
chmod 777 scans
smbpasswd -a pi

Next, I added the following to /etc/samba/smb.conf

    [scans]
        valid users = pi
        path = /home/pi/scans
        writeable = yes
        create mask = 0777
        directory mask = 0777
        public = no

Scanbd - “the scan button”

Next, we need to listen for the scan button. Thankfully there is scanbd which will do this for us.

First, I update /etc/scanbd/scanbd.conf by setting

scriptdir=/etc/scanbd/scripts

and in

action scan I add this:

    desc = "Scan to file and share"
    script = "scan.sh"

Finally, I create scan.sh as (vi /etc/scanbd/scripts/scan.sh):

#!/bin/sh
now=`date +"%Y-%m-%d-%H%M"`
/home/pi/sane-scan-pdf/scan -d -r 300 -v -m Lineart --skip-empty-pages -o /home/pi/scans/scan-$now.pdf

Done!

Now when push the scan button; the ADF scanner runs and the PDF appears in the shared drive! Magic!

Special thanks Phillipp Keller for his write up on his network scanner to S3. I learned a lot from his fight and worked from it.

[ pi linux home-automation ]