PSPrint - a Unix print solution
History
StarOffice 5.2 (and earlier) relied on a thirdparty solution for printing. This solution could of course not be open sourced as it was a commercial product. So when StarOffice became OpenOffice there was no printing possible at all on the Unix platforms; just a wrapper was provided that contained stubs fitting the missing symbols left in vcl. A new print solution was desperately needed, so a variety of existing print solutions were examined, the most notable of which were gnome-print and Xprint. Gnome-print did not really fit into OpenOffice.org, since it would require to link against a huge amount of other gnome libraries, too, which is unacceptable for OpenOffice.org, because we want to run on many desktops. Xprint was designed as a standard Unix print solution and has many advantages: code for the display would work exactly the same way on the printer. A proof of concept version was created by Martin Maher and Oisin Boydell with help from Hamburg and the US which made it into OpenOffice.org as a temporary solution to have minimal print support on Unix. But Xprint in its current state misses many features that become increasingly important: fast character metric handling, access to glyph substitution tables, easy configurability on a per user basis just to name a few. Also one cannot really say that it has become the standard solution for printing on Unix yet; in fact only recently it was awakened from its long beauty sleep having its major bugs fixed so it is now useable.
This led to the decision that as long as there is no standard solution scratching a sufficient number of our itches OpenOffice.org should do like everyone else and produce its own PostScript code. Hence psprint entered the game.
Features
international, multilingual print support through abstraction to Unicode (UCS2).
support for vertical writing (mostly for CJK printing)
support for TrueType fonts and TrueType collections, embedded as Type3 or Type42
support for Type1 fonts
support for printer resident fonts
size optimized output using font subsetting for TrueType fonts/collections
configurable font substitution: replaces fonts that require embedding with printer resident fonts on a per glyph basis
use of vertical glyphs through GSUB substitution for TrueType fonts
image compression using lzw compression and ascii85 encoding
easy user configurability through printer adminstration utility (spadmin)
support for printer specific features (everything you can put into a PPD (PostScript Printer Description))
support for portable PostScript generation through generic PPD
automatic recognition of system printer queues
support for pdf conversion and fax (external applications like ghostscript/mgetty+sendfax required)
Overview
PSPrint consists of the following major parts:
Font management: done by the
PrintFontManager
class. This class handles font discovery as well as font information like metrics and font properties.Printer management: done by the
PrinterInfoManager
class. This class handles printer discovery and information. It can store and load properties of a printer, most important the default job setup (which contains information like paper size, orientation, etc.). To know about a printers capabilities you need PPD (PostScript Printer Description) files which can be parsed with thePPDParser
class.Graphic operations: done by the
PrinterGfx
class. This is really the work horse of PSPrint. It handles all kinds of text output, drawing operations, bitmaps and the like.Font subsetting: provided by Alexander Gelfenbain. This enables PSPrint to make use of TrueType fonts and collections in a very effective way by sending just the glyphs that are needed down to the printer.
Job management: done by the
PrinterJob
class. This class ties the PostScript code produced by PrinterGfx together downloading the necessary fonts as well as providing a framework for the raw PostScript code.