Last active
November 4, 2024 20:49
-
-
Save kwharrigan/7485294 to your computer and use it in GitHub Desktop.
A simple script to form a multipage PDF using scanimage / sane. It is hard-coded to my MF4270 device id as provided by scanimage -L.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
outname=$1 | |
startdir=$(pwd) | |
tmpdir=scan-$RANDOM | |
DEVICENAME=pixma:04A926B5_SFF780310398A | |
if [ $# -lt 1 ] | |
then | |
echo "Usage: scan.sh <filename.pdf>" | |
exit 1; | |
fi | |
cd /tmp | |
mkdir $tmpdir | |
cd $tmpdir | |
echo "################## Scanning ###################" | |
scanimage -d $DEVICENAME --source "Automatic Document Feeder" --mode Gray --batch --format=tiff --resolution 150 | |
echo "############## Converting to PDF ##############" | |
#Use tiffcp to combine output tiffs to a single mult-page tiff | |
tiffcp -c lzw out*.tif output.tif | |
#Convert the tiff to PDF | |
tiff2pdf output.tif > $startdir/$outname | |
cd .. | |
echo "################ Cleaning Up ################" | |
#rm -rf $tmpdir | |
cd $startdir |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
it helped, thanks!