Created
March 20, 2009 22:27
-
-
Save kubicek/82621 to your computer and use it in GitHub Desktop.
This file contains 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
/usr/local/bin/gs -dSAFER -dNOPAUSE -q -sDEVICE=ljet4 -sOutputFile=- /home/kubicek/margin.ps - | /usr/local/libexec/tray_select.rb -L | |
This file contains 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
source_pdf=$1 | |
pages_count=`pdftk $source_pdf dump_data | grep NumberOfPages | awk '{print $2}'` | |
echo "Processing $pages_count pages" | |
if test $pages_count -eq 1 | |
then | |
echo "Printing first page" | |
cat $source_pdf | lpr -Pir1022_lower_tray | |
fi | |
if test $pages_count -gt 1 | |
then | |
echo "Printing first two pages" | |
pdftk $source_pdf cat 1-2 output - | lpr -Pir1022_lower_tray | |
fi | |
if test $pages_count -gt 2 | |
then | |
echo "should print some pages on white paper" | |
echo "printing aditional pages" | |
pdftk $source_pdf cat 3-end output - | lpr -Pir1022_upper_tray | |
fi | |
This file contains 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
#!/usr/local/bin/ruby | |
data = $stdin.read | |
case ARGV[0] | |
when "-L": print "\e&l4H" # Lower | |
when "-U": print "\e&l1H" # Upper | |
else print "\e&l2H" # Manual | |
end | |
print "\e&l1S" # DUPLEX | |
puts data[2..-1] | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment