#!/bin/sh # Please see detailed copyright below. PATH=/bin export PATH # This is the input filter that I use for my HP Deskjet 960c. # If you are using a different model, you will have to change # the -sDeviceModel= parameter below. You will probably also # want to change some of the other parameters. Check out the # hpijs_readme.html file in /usr/local/share/doc/hpijs for # more information on settings available per printer model. # I use the ghostscript-afpl port, but this should work # equally well with other types of gs. # # To use this, copy it into a handy location (the sample printcap # file in this directory assumes /usr/local/etc/bin/), adjust # /etc/printcap accordingly, adjust any settings below, start or # restart lpd, and start printing! # # For more information, check out the handbook section on printing: # http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/printing.html # Send a reset, then Treat LF as CR+LF: # printf "\033E\033&k2G" || exit 2 # Read first line of the file to determine type of input # read first_line case "${first_line}" in \%\!*) # # PostScript input, so use ghostscript and hpijs # http://hpinkjet.sourceforge.net/printmodedescr.php#DJ9xxVIP # /usr/local/bin/gs -q -dNOPAUSE -dSAFER -r600x600 \ -sDEVICE=ijs -sIjsServer=/usr/local/bin/hpijs -dIjsUseOutputFD \ -sDeviceManufacturer="HEWLETT-PACKARD" -sDeviceModel="DESKJET 960" \ -sIjsParams="Quality:Quality=0,Quality:ColorMode=2,Quality:MediaType=0,Quality:PenSet=2" \ -sOutputFile=- - && exit 0 ;; *) # # Plain text or HP/PCL, so just print it directly. # Print a form feed at the end to eject the last page. # echo $first_line && cat && printf "\033&l0H\033E" && exit 0 ;; esac # Should not be reached exit 2 # Copyright (c) 2003-2004 Doug Barton # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # 1. Redistributions of source code must retain the above copyright # notice, this list of conditions and the following disclaimer. # 2. Redistributions in binary form must reproduce the above copyright # notice, this list of conditions and the following disclaimer in the # documentation and/or other materials provided with the distribution. # # THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE # ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS # OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF # SUCH DAMAGE.