Skip to content

Instantly share code, notes, and snippets.

@bertabus-zz
Created June 7, 2016 03:18
Show Gist options
  • Select an option

  • Save bertabus-zz/c180c8aadffba65f95e2c5409fdecd5c to your computer and use it in GitHub Desktop.

Select an option

Save bertabus-zz/c180c8aadffba65f95e2c5409fdecd5c to your computer and use it in GitHub Desktop.
#!/bin/sh
# Usage scanPaper /output/path/forScan
# Scan an '11-8.5' paper and convert to pdf
# Place pdf in /output/path/forScan
# Does not remove /tmp/scan by default, uncomment last
# line to remove temporary file afterwards
scanimage --mode Binary --resolution 600 -x 215.9 -y 279.4 > /tmp/scan.ppm
ppm2tiff /tmp/scan.ppm /tmp/scan.tiff
tiff2pdf /tmp/scan.tiff > /tmp/scan.pdf
md5=$(md5sum /tmp/scan.pdf | cut -d ' ' -f 1)
date_stamp=$(date "+%Y_%m_%d")
mv /tmp/scan.pdf $1/${date_stamp}\ ${md5}.pdf
# rm /tmp/scan.*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment