Ghostscript is
an incredibly significant program for Linux printing. Most printing
software under Unix generates PostScript, which is typically a
$100 option on a printer. Ghostscript, however, is free, and
will generate the language of your printer from PostScript. When tied
in with your PDQ printer driver declaration or lpd
input filter,
it gives you a virtual PostScript printer and simplifies life
immensely.
Ghostscript is available in two forms. The commercial version of Ghostscript, called Aladdin Ghostscript, may be used freely for personal use but may not be distributed by commercial Linux distributions. It is generally a year or so ahead of the free Ghostscript; at the moment, for example, it supports many color inkjets that the older Ghostscripts do not.
The free version of Ghostscript is GNU Ghostscript, and is simply an aged version of Aladdin ghostscript kindly given to GNU. (Kudos to Aladdin for this arrangement; more software vendors should support free software in this way, if they can't handle full-blown GPL distribution of their code).
Whatever you do with
gs
, be very
sure to run it with the option for disabling file access
(-dSAFER
). PostScript is a fully functional language, and a bad
PostScript program could give you quite a headache.
Speaking of PDF, Adobe's Portable Document Format is actually little more than organized PostScript in a compressed file. Ghostscript can handle PDF input just as it does PostScript. So you can be the first on your block with a PDF-capable printer.
Typically, Ghostscript will be run by whatever magic filter you settle upon (I recommend apsfilter if your vendor didn't supply anything that suits you), but for debugging purposes it's often handy to run it directly.
gs -help
will give a brief informative listing of options and
available drivers (note that this list is the list of drivers compiled
in, not the master list of all available drivers).
You might run gs for testing purposes like:
gs options -q -dSAFER -sOutputFile=/dev/lp1 test.ps
.
There are a number of things one can do if gs's output is not satisfactory (actually, you can do anything you darn well please, since you have the source).
Some of these options, and others described in the Ghostscript User
Guide (the file Use.htm
in the Ghostscript distribution;
possibly installed under /usr/doc or /usr/share/doc on your system)
are all excellent candidates for driver options in your PDQ driver
declaration.
The location, size, and aspect ratio of the image on a page is controlled by the printer-specific driver in ghostscript. If you find that your pages are coming out scrunched too short, or too long, or too big by a factor of two, you might want to look in your driver's source module and adjust whatever parameters jump out at you. Unfortunately, each driver is different, so I can't really tell you what to adjust, but most of them are reasonably well commented.
Most non-laser printers suffer from the fact that their dots are rather large. This results in pictures coming out too dark. If you experience this problem you should use your own transfer function. Simply create the following file in the ghostscript lib-dir and add its name to the gs call just before the actual file. You may need to tweak the actual values to fit your printer. Lower values result in a brighter print. Especially if your driver uses a Floyd-Steinberg algorithm to rasterize colors, lower values ( 0.2 - 0.15 ) are probably a good choice.
---8<---- gamma.ps ----8<---
%!
%transfer functions for cyan magenta yellow black
{0.3 exp} {0.3 exp} {0.3 exp} {0.3 exp} setcolortransfer
---8<------------------8<---
It is also possible to mend printers that have some kind of colour fault by tweaking these values. If you do that kind of thing, I recommend using the file colorcir.ps, that comes with ghostscript (in the examples/ subdir), as a test page.
For many of the newer color inkjet drivers, there are command-line options, or different upp driver files, which implement gamma and other changes to adapt the printer to different paper types. You sould look into this before playing with Postscript to fix things.
Ghostscript's default color dithering is optimized for low-resolution devices. It will dither rather coarsely in an attempt to produce 60ppi output (not dpi, ppi - the "apparent" color pixels per inch you get after dithering). This produces rather poor output on modern color printers; inkjets with photo paper, in particular, are capable of mich finer ppi settings.
To adjust this, use the Ghostscript option -dDITHERPPI=x, where x is the value to use. This may or may not have an effect with all drivers; many newer drivers implement their own dithering and pay no attention to this setting. Some drivers can use either the regular Ghostscript or driver-specific dithering.
This makes for an excellent argument in a PDQ driver declaration, if it applies.