PRINT HINTS FROM LUKE & ZZ

COLOR PRINTING WITH LASERWRITER 6.0 REVISITED

PETE "LUKE" ALEXANDER and Zz

Luke speaks

 With the release of 32-Bit QuickDraw version 1.0, Apple wanted to find a way to
support color printing on the high-end (albeit black-and-white) LaserWriter® II, as
well as other, third-party devices. So, the great implementors (GIs) created a new
LaserWriter driver--version 6.0. This driver added a new Color/Grayscale button to
the print dialog, allowing users to print their "way cool" color pictures that were
created with 32-Bit QuickDraw. All was happy in the land of Apple's new color model.
But wait! There was a problem lurking on the horizon, a problem called the PostScript
Offending Command Error.

 Imagine this scenario: You've just created a cool 32-Bit QuickDraw picture, a true
masterpiece, and all seems to be going well. You decide to print your picture and show
it off to Mom. You choose Print from the File menu; the print dialog appears, and you
click OK. A few minutes pass, and voilà: a printed page containing your picture.
Life is gooood.

 With this success, you're now dreaming of other pictures that you'll be able to create
and print. You create another cool 32-bit picture. You choose Print from the File
menu; the print dialog appears, and you click OK. A few minutes pass, and this time the
PostScript Offending Command Error dialog appears, looking something like this:

 Error: LimitCheck; Offending Command: 080AGOBBLEDEGOOK0B

 What's this? An offending command? But all you wanted to do was print your color
picture. You were able to print your first picture a few minutes ago. What's going on?
Unfortunately, LaserWriter driver version 6.0 does not reliably print images that are
deeper than 8 bits. We won't bore you with the details: just think of the LaserWriter
driver as a shark, ready to swallow a surfer off the California coast. But instead of the
surfer dude it was expecting, in rushes the surfer dude's surfboard. The LaserWriter
driver chokes on deeper images just as our poor shark chokes on the surfboard; the
driver is ready to receive a particular variable but occasionally receives something
different, and doesn't know what to do with it. The result: the PostScript Offending
Command Error. Life is no longer so good; your dreams are beginning to fade away. But
I can see a solution appearing on the horizon . . .

 Actually, there are three possible solutions: you can use LaserWriter driver version
6.1 (or version 7.0 when it's available); you can depth-convert your image from 32
bits to 8 bits using 32-Bit QuickDraw; or you can use the PostScript ® image
operator to generate PostScript code for your image, and send it directly down to the
LaserWriter. Let's look at each solution.

 Using LaserWriter driver version 6.1 is the simplest solution. LaserWriter driver
version 6.1 likes data of any depth, no matter when it's sent. So, if you're printing to
LaserWriter driver version 6.1, life is happy when you're printing your 32-bit
images--but how can you be sure that you're using LaserWriter driver version
6.1?You can call PrDrvrVers, which is provided by the Printing Manager to enable
your application to determine which version of a particular printer driver you're
talking to. But there's a minor problem with this call. You don't know if you're talking
to a PostScript LaserWriter or some other device. So, you must dive into the bowels of
the print record for additional information. You need to check the high byte of the wDev
field of the TPrStl record to determine a particular driver and version. But wait! You
thought checking wDev was evil. In this case, using wDev is OK because you're not
checking for particular functionality of a driver, and thereby not making your code
device dependent. If wDev is 3, you know that you're talking to a PostScript
LaserWriter. Non-PostScript LaserWriters (for example, the LaserWriter IIsc) have
a different value for the wDev field. You would then call PrDrvrVers to determine if
you're talking to LaserWriter driver version 6.1. If PrDrvrVers returns 61, you
know that you're using LaserWriter driver version 6.1, and life is good again. If wDev
is 3, and the driver version is less than 61, you're not using LaserWriter driver
version 6.1, so you have a little more work to do: try the next solution.

The next possible solution is to use 32-Bit QuickDraw to depth-convert your 32-bit
image to 8 bits by using 32-Bit QuickDraw's GWorld support. You would first create
an 8-bit GWorld containing a grayscale CLUT, and use CopyBits to copy your 32-bit
image into it. You would then use CopyBits to copy the 8-bit image directly into the
printer's grafPort, and voilà--your image would be printing.   This approach
works with LaserWriter driver version 6.0 and later.

Your final option is to use the PostScript image operator to generate PostScript code
that represents your 32-bit image. This approach is a little more complex than the
32-Bit QuickDraw idea. To send your data down to the LaserWriter, you would need to
use the PostScriptHandle PicComments with the image operator. If you're already
sending PostScript code to the LaserWriter, this is probably the best approach.

By the way, if you don't have a copy of LaserWriter driver version 6.1, it's available
on theDeveloper Essentials disc. If you want to ship this version of the driver with
your application, you should contact Apple Software Licensing for the details.

In conclusion, we have some good news and some bad news. The good news is that we've
fixed the 32-bit image printing problem that was present in LaserWriter driver
versions 6.0, 6.0.1, and 6.0.2. LaserWriter driver version 6.1 will allow you to
print pictures that are 1 bit to 32 bits deep without any problems. The bad news is
that if you want your application to print all depths of pictures with LaserWriter
driver version 6.0, you're going to need to do a little extra work, either depth-
converting your pictures from 32 bits to 8 bits before print time, or using the
PostScript image operator to generate PostScript code for your image. Now that's not
so bad, is it?

 

 

PETE "LUKE" ALEXANDER spends much of his Developer Technical Support time
diving deep into the bowels of the Printing Manager, where he never turns up his nose
at a challenge or at odiferous code that needs explaining. Although that kind of diving is
fun, he prefers the balmy blue waters of anyplace (preferably far from computers)
that has both beach and beer close together. If he can't get away from it all on the beach
somewhere, he'll settle for getting above it all in his glider; with Luke, being up in the
air about something takes on a whole new meaning. Fortunately, not everything on the
horizon is blue sky. Luke's looking forward to the cool new printing architecture that
will make his job (and yours) a lot easier. He's preparing for this new architecture
by spending a week sailing around the Caribbean--figuring that he'd better start
getting used to a life of leisure. Until that leisure can become a lifestyle, you can count
on seeing lots from Luke. *

For details regarding the use of the PostScriptHandle PicComments, take a look at
Technical Note #91, Optimizing for the LaserWriter--PicComments. *

For details about depth-converting your 32-bit images or using the PostScript
image operator, see Technical Note #72, Color Printing. *