first script from utils imgs2pdf

master
Castro0o 7 years ago
commit 73003276e4

@ -0,0 +1,14 @@
# Utility Scripts for scanning documents
## Software dependencies:
pdftk, imagemagick
## Scripts
### imgs2pdf.sh
Converts a directory of images onto a single PDF
Usage: ./imgs2pdf.sh imgs-dir-name pdf-filename
If no pdf-filename is provided, output.pdf will the default file name

@ -0,0 +1,43 @@
#!/bin/sh
# Script to convert directory of images onto a single PDF
# Software dependencies: pdftk, imagemagick
# Usage: ./imgs2pdf.sh imgs-dir-name pdf-filename
# if no pdf-filename is provided, output.pdf will the default file name
DIR=""
FILENAME=""
echo ${#1}
if [ ${#1} -gt 0 ] # check arguments given
then
DIR=$1
echo "Images from $DIR directory are being converted onto PDF"
if [ ${#2} -gt 0 ]
then
FILENAME=$2
else
FILENAME=output.pdf
fi
echo "under the filename: $FILENAME"
PROCESS=true
else
echo "You forgot to provide the images directory as the first argument"
PROCESS=false
fi
if $PROCESS true;
then
echo "processing..."
for IMG in $DIR* # convert imgs to tmp pdfs
do PDF=${IMG%.*}.pdf
convert -density 200 $IMG $PDF
done
pdftk $DIR*.pdf cat output $FILENAME # concatonate single pdf into 1 pdf
fi
Loading…
Cancel
Save