Skip to content

Instantly share code, notes, and snippets.

@hlev
Created November 24, 2017 12:29
Show Gist options
  • Save hlev/37f9a88e61b9d610b372c116f2b7fc78 to your computer and use it in GitHub Desktop.
Save hlev/37f9a88e61b9d610b372c116f2b7fc78 to your computer and use it in GitHub Desktop.
Helper script to scan straight to PDF with network scanner on the LAN using scanimage and unoconv
#!/usr/bin/env bash
# usage: scan2pdf output
# results in: output.pdf
# possible improvements:
# - config file for IP, default resolution, sleep time
# - device discovery
# - platform-agnostic temp file usage
# - investigate parsing errors of otherwise successful conversions
tmpfile=$(mktemp /tmp/scan.XXXX);
scanimage -d 'smfp:net;<ip_of_scanner>' --resolution 150 > "$tmpfile"
sleep 6
unoconv -o $1.pdf "$tmpfile"
rm "$tmpfile"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment