Convert pdf files to jpg

I have made a simple script that converts a directory of pdf files into a directory of jpg files. I use it very often because every pdf client’s start is terribly long, and the view of large files is better with a jpg image than a pdf file with a tif inside.
I use pdfimages and convert to do the trick, and it’s quite fast (enough to be useful for my purpouses).


#!/bin/bash
directory=`date +%x | tr "/" "-"`
directory=storico/$directory
mkdir $directory

if [ $? == 0 ]; then

# wget -m -np -nd http://www.comune.forli.fo.it/rassegna
for articolo in `ls -1 *.pdf`
do
pdfimages $articolo $articolo
convert $articolo-000.pbm -scale 40% -negate -quality 30 $directory/$articolo.jpg
done
rm *.pbm
# album rassegna -index index -medium 800x600
fi
exit 0

Convert pdf files to jpg
Torna su
Exit mobile version