scanadf2docspell

June 29, 2022 ยท View on GitHub

This script scans from the ADF (Automatic Document Feeder), preprocesses it and uploads it to Docspell.

Codacy Badge Quality Gate Status CodeFactor MegaLinter

Overview

Prerequisites

  • A running Docspell instance.

  • Any Linux distro (tested on Ubuntu 20.04)

  • Install system requirements (apt command on Ubuntu:)

    sudo apt install sane python3 python3-pip libmagickwand-dev img2pdf sane-utils
    
  • See if scanimage is able to find your scanner

    scanimage -L
    
    • if scanner is not found -> check sane-find-scanner
      • Maybe also as sudo to see if it's an privileges problem
      • If yes try sudo adduser <username> lp and logout/login and restart scanner

Install

  • Clone the repository

    git clone https://github.com/eresturo/scanadf2docspell
    
  • Install requirements

    cd scanadf2docpsell
    pip3 install -r requirements.txt
    
  • Generate a API-Key, as described here

  • create a config file custom.conf

    api_key: 'YOUR_API_KEY'
    docspell_url: 'http://YOUR_DOCSPELL_URL'
    

Scanner specific adjustments

Unfortunately, scanimage arguments are partially dependent on the scanner. Therefore, a customized configuration per scanner may be necessary. For this purpose, you can specify with which command a flatbed, with which a single-page adf scan and with which a duplex adf scan can be triggered.

tested ScannersConfig (custom.conf)
Epson XP 860 (default)command_flatbed: '--source Flatbed'
command_adf: '--source "Automatic Document Feeder" --adf-mode Simplex'
command_duplex_adf: '--source "Automatic Document Feeder" --adf-mode Duplex'
HP 5590command_flatbed: '--source Flatbed'
command_adf: '--source ADF'
command_duplex_adf: '--source "ADF Duplex"'

Note: This list is far from complete. Which scanner do you use and which configuration is needed? Please tell us in an issue or pull request.

Scan

  • insert a document in your scanner and run

    ./scan.py
    
  • See help for further options.

    ./scan.py --help
    

Contribution

Suggestions, feature requests, ideas to improve the script? Feel free to open an issue or send a pull request :)