This is a small filter for suppressing extra pagefeeds that the Windows Postscript Driver produces when printing to a BSD lp raw queue. This script can easily be applied to other printing systems like cups or other unix compliant oses.
Fire the following code to a 0755 script i.e. in /usr/local/bin/rawmatic and replace /dev/lpt0 with your favourite printer’s device.
#!/usr/bin/perl ## Simple postscript filter for raw printing ################################################################# open (RAW, "> /dev/lpt0") ; while(<>) { s/\004(\033\%-12345X\@PJL EOJ)/$1/ ; print RAW $_ ; } close RAW ;
Now edit /etc/printcap (or your printing systems’ queue definition) to pipe the postscript job to the rawmatic script. Replace the keys ‘lp’ and ‘if’:
raw|lp3|hp5raw|PS_HP5 a4 raw:\ :lp=/dev/null:\ :sd=/var/spool/lpd/PS_HP5-a4-raw:\ :lf=/var/spool/lpd/PS_HP5-a4-raw/log:\ :af=/var/spool/lpd/PS_HP5-a4-raw/acct:\ :if=/usr/local/bin/rawmatic:\ :la@:mx#0:\ :tr=:cl:sh:
Restart your print spooler and test your new filter. You’ll be happy saving much paper.