Print pdf files from bash
Tired of manually doing pdf2ps and then lpr so you can print from the commandline. This bash function is the solution.
function printpdf ()
{
for i in $@; do
if [ "$1" != "$i" ]; then
dt=`date +%y%m%d%H%M%S`
pdftops $i temp-print${dt}.ps
lpr -P $1 temp-print${dt}.ps
rm temp-print${dt}.ps
fi
done
}
Usage:
printpdf printername file1.pdf file2.pdf file3.pdf ….
Leave a Comment