Printer filters and Utilities


A modified printer filter from the original a2ps code (4.0) that also counts pages, doesn't core dump. Return code is number of pages in file (or error)

A modified version of a2ps that acts as a simple filter to convert ASCII to PS but pass already PS documents straight through is available here.

hpif is an input filter for HP laserjet style printers. These printers use DOS style end-of-line determination, so that UNIX machines (that use newlines) often send them text that goes down and to the right. This filter will fix that problem with ASCII text jobs, but will pass preformatted PostScript jobs straight through. (Of course, if your printer doesn't have a PostScript cartridge, or is not PostScript capable, then DON'T send it PostScript jobs or you'll end up with a big mess). It also adds a control-L to the end of PS jobs to force the last page to eject from the printer. Why do they have to be different!?

Hitler is a fascist printer filter that I wrote. (Please do not take offense if you are Jewish, I mean no harm). It has several functions. We use it on one of our PC print servers. First, it determines if the job is PostScript, PCL, or ASCII. If the job is ASCII or PCL and has more than 10 binary characters (bytes whose octal value is less than 7) it is rejected as a binary file. If the job is more than 20,000 characters is is rejected as a file that is too large (possibly a PS job gone awry). It will save rejected files in /tmp for later inspection as well. It is not a true input filter, but can be called from one. Your input filter should send the data to a temporary file. Hitler will then operate on the temporary file and send its results to standard output. This is necessary so that it can determine the size of the file before easily and quickly without processing the entire file.

stripd is a very simple filter that will strip the leading control-D from PS jobs generated my MS Windows machines. Autocad is particularly notorious for this, but other apps will have it in there as well. To be fair, it's Micro$oft's fault and not the application.

printfile is a miscellaneous utility that I wrote to test serial printers and cables. You hookup the printer, run printfile, followed by the name of the port and the file, and it will send the file directly out the port. It also has some switches for controlling baud rate. The default baud rate is 38400, but you can set it to 19200 or 9600 if you want via switches. It comes in handy on Solaris machines with that bloody awful lp print service.

header is a little program I wrote to generate an attractive header page (generates PostScript). It has the date, user's name, number of pages they printed, and number of pages they have left (we have accounting turned on, each user is allocated 100 pages per quarter free, and must by pages thereafter). It reads the header generated by berekeley lpd software. So if you store this header in a file (has Job, etc in it) using the sb directive in your printcap, this program reads that file to generate the PS banner page.