Skip to content

Instantly share code, notes, and snippets.

@NickWoodhams
Created January 29, 2013 22:07
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save NickWoodhams/4668402 to your computer and use it in GitHub Desktop.
Save NickWoodhams/4668402 to your computer and use it in GitHub Desktop.
Print a UPS Label GIF on a Zebra 2844 @203 PPI
#!/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