• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar

Gagne.homedns.org

  • Gagne
  • Content Negotiation in Internet Mail
    • Information Overload
    • Internet Mail Overload
    • Value Of Organizing
    • Organizing Through Categorization
    • Categorization Through Negotiation
    • Odyssey of Content Negotiation
    • Rule Based Negotiation
    • Machine Learning in The Laboratory
  • Unix Resources
    • T-DSL router with Free BSD 5.0
    • Advantech PCM-4823l as a FreeBSD Router
    • Using the Centronics (Printer) Port as a Network Interface
    • Suppressing Extra Pagefeeds
  • Development Resources
    • Url Decoding with bin-utils

Suppressing Extra Pagefeeds

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.

Primary Sidebar

Unix Resources

  • T-DSL router with Free BSD 5.0
  • Advantech PCM-4823l as a FreeBSD Router
  • Using the Centronics (Printer) Port as a Network Interface
  • Suppressing Extra Pagefeeds

Development Resources

  • Url Decoding with bin-utils