-
-
Save hakanensari/4770760 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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