Skip to content

Instantly share code, notes, and snippets.

@hakanensari
Forked from NickWoodhams/zebraprint.sh
Created February 12, 2013 15:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hakanensari/4770760 to your computer and use it in GitHub Desktop.
Save hakanensari/4770760 to your computer and use it in GitHub Desktop.
#!/bin/sh
filename=$1
echo "Begin processing file:" $filename
dimensions=$(identify -format '%w %h' $filename)
IFS=' ' read -a array <<< "$dimensions"
width=${array[0]}
height=${array[1]}
echo "Width is " $width
echo "Height is " $height
if [ "$width" -gt "$height" ]
then
echo "Printing landscape!"
convert $filename -density 203 -rotate 270 /tmp/printjob.ps
rm $filename
else
echo "Printing Portrait"
convert $filename -density 203 /tmp/printjob.ps
rm $filename
fi
lp -o ppi=203 -o natural-scaling=100 /tmp/printjob.ps
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment