# Paperless Scanner Integration (SANE/AirScan) When the printer's web admin password is unknown or scan-to-FTP can't be configured from the touchscreen, scan from the server directly using SANE and the AirScan/eSCL network protocol. No printer configuration needed — the server pulls scans from the printer over the network. Tested with Brother MFC-J5855DW on Ubuntu 26.04. ## Architecture ``` Server command: scan-to-paperless → SANE/AirScan (eSCL over HTTP) → Brother MFC (192.168.50.219:80) → PDF saved to /mnt/seagate8tb/paperless/consume/ → Paperless auto-ingests (OCR, classify, tag) ``` ## Setup ### 1. Install sane-airscan ```bash sudo apt install -y sane-airscan sane-utils ``` No Brother drivers needed — `sane-airscan` uses the driverless eSCL/AirScan protocol that most modern network MFCs support. ### 2. Verify detection ```bash scanimage -L # Should show: # device `airscan:e0:Brother MFC-J5855DW' is a eSCL Brother MFC-J5855DW ip=192.168.50.219 ``` ### 3. Fix consume folder permissions The consume folder may be owned by a Docker-created user. Add ACL for the local user: ```bash sudo setfacl -m u:ray:rwx /mnt/seagate8tb/paperless/consume ``` ### 4. Install scan script ```bash sudo tee /usr/local/bin/scan-to-paperless << 'SCRIPT' #!/bin/bash set -e DEVICE="airscan:e0:Brother MFC-J5855DW" CONSUME="/mnt/seagate8tb/paperless/consume" MODE="Color" RES="300" SOURCE="ADF" NAME="" while [[ $# -gt 0 ]]; do case "$1" in --flatbed) SOURCE="Flatbed" ;; --gray) MODE="Gray" ;; --150dpi) RES="150" ;; *) NAME="$1" ;; esac shift done SCAN_OPTS="--mode $MODE --resolution $RES" [ "$SOURCE" = "ADF" ] && SCAN_OPTS="$SCAN_OPTS --source ADF --batch-count=1" TIMESTAMP=$(date +%Y%m%d_%H%M%S) FILENAME="${NAME:-scan}_${TIMESTAMP}.pdf" OUTFILE="$CONSUME/$FILENAME" echo "Scanning ($SOURCE, $MODE, ${RES}dpi) → $FILENAME" scanimage --device "$DEVICE" $SCAN_OPTS --format pdf -o "$OUTFILE" SIZE=$(du -h "$OUTFILE" | cut -f1) echo "Done — $SIZE saved to Paperless" SCRIPT sudo chmod +x /usr/local/bin/scan-to-paperless ``` ### Usage ```bash scan-to-paperless # ADF, color 300dpi scan-to-paperless invoice # names it "invoice_20260614_172310.pdf" scan-to-paperless --flatbed # use flatbed instead of document feeder scan-to-paperless --gray # black & white scan-to-paperless --150dpi # lower resolution (smaller file) scan-to-paperless receipt --flatbed --gray # combine flags ``` ## Pitfalls - **`/usr/local/bin` may be noexec**: If direct execution fails, use `bash /usr/local/bin/scan-to-paperless` or install the script to `~/.local/bin/`. - **No paper in ADF**: If the ADF is empty, `scanimage` exits with error. The `set -e` in the script catches this. Use `--flatbed` if loading a single page. - **Permission denied on consume folder**: Docker often creates the consume folder with root ownership. Use `setfacl` to grant the local user write access without changing Docker's ownership. - **vsftpd `nologin` shell**: If also setting up FTP, vsftpd's PAM rejects `/usr/sbin/nologin`. Add it to `/etc/shells`.