Previous Table of Contents Next


To print on Hewlett-Packard printers, PRINTPCX.C first determines what printer model is specified from the program input arguments. It then sends the correct printer initialization escape sequences. Table 8-3 illustrates which sequences PRINTPCX.C sends to which Hewlett-Packard printers. The ultimate programming source for this printer family is Hewlett-Packard’s 150-page DeskJet Printer Family Software Developer’s Guide available directly from Hewlett-Packard. This manual’s 35-page Graphics Control section provides extensive escape sequence guidance as well as an essential gray balancing algorithm.

Escape Sequence LaserJet and DeskJet 500 DeskJet 500C DeskJet 550C Comment
HpReset Y Y Y Resets printer
HpSetPortraitOrientation       Portrait orientation (11" high, 8.5" wide)
HpSetPerfSkipOff       Start printing at top left of page
HpEndRstrGr Y Y Y Defensive escape sequence to force defaults
HpSet1PlanePerRowBw Y     Print one bilevel plane (black and white)
HpSet3PlanesPerRowRGB       Print three bilevel planes (RGB input)
HpSet3PlanesPerRowCMY   Y   Print three bilevel planes (CMY input)
HpSet4PlanesPerRowKCMY     Y Print three bilevel planes (KCMY input)
HpSetRstrGrResolution75       Print bilevel output at 75 dpi
HpSetRstrGrResolution100       Print bilevel output at 100 dpi
HpSetRstrGrResolution150       Print bilevel output at 150 dpi
HpSetRstrGrResolution300 Y Y Y Print bilevel output at 300 dpi
HpSetRstrGrWidth Y Y Y Specifies horizontal scan line width
HpSetRstrGrPrintMode Y Y Y Print using smart bi-directional movements (default)
HpSetDepletionLevel Y Y Y Do not remove any dots—print them all.
HpSetShinglingLevel Y Y Y Create dots in order without interlacing
HpSetRstrGrQualityKeypad Y Y Y Check user set printer keypad for print quality
HpSetRstrGrQualityDraft       Use draft print quality to conserve ink
HpSetRstrGrQualityHigh       Use high print quality
HpStartRstrGr Y Y Y Start raster graphics
HpSetRstrGrCompressionMethod Y Y Y Selects the compression method (none for PRINTPCX.C)
HpTransferRstrGrData       Sends all but the first plane scan lines on an output row
HpTransferRstrGrLastData       Sends the last (or only) plane scan line

Table 8-3: Escape sequences PRINTPCX.C uses with various printers

If the printer is a LaserJet or DeskJet 500, PRINTPCX.C converts the color image into an achromatic gray scale image. Because Hewlett-Packard printer vertical and horizontal images are equal as they are in the scanning resolutions for all sample images, no scaling is required to compensate for unequal horizontal and vertical resolutions. However, because 300 dpi is a relatively high resolution, PRINTPCX.C magnifies images up to MAX_REPLICATION_FACTOR times using horizontal linear interpolation to calculate values falling between input pixel values. These interpolated lines are then replicated vertically the correct number of times to provide appropriate vertical scaling.

Finally, the CMY and CMYK values are gray balanced to provide truer gray shades by reducing cyan ink levels near the RGB cube achromatic diagonal. After adjusting the gray balance, the RGB values are individually error diffused within their color planes to produce their final individual bilevel output scan lines. When printed on Hewlett-Packard Premium InkJet Glossy Paper, the results sometimes have to be seen to be believed. The colors seem to lunge off the paper.


Previous Table of Contents Next