Using the PostScriptHandle PicComment, a Friend Indeed
Think of the PostScriptHandle PicComment as your friend. Use it, but be aware of its limitations. Because this PicComment lets you send huge chunks of PostScript directly to a printer, it's your obvious choice. However, there are a few gotchas that you need to consider.
The LaserWriter driver has control of your coordinate system.
This means that the normal PostScript coordinate system you know and love has been transformed, i.e., coordinates now match the QuickDraw orientation. This actually makes things easier for you. When you include the QuickDraw representation of the PostScript you're sending, the coordinate system will be the same as the one you used for the PostScript. You don't have to think about converting the coordinates. If you do
include a QuickDraw PICT so you can print to QuickDraw printers, you should bracket this QuickDraw representation with the
Also, if the user selects 2-up or a similar option in the print driver, all the coordinates get transformed behind your back by the driver. The consequence of your app "thinking" it knows the coordinate system is that your app may end up coloring outside the lines. That's another good reason to keep things simple so you don't outsmart yourself.
The QuickDraw side of the imaging engine in the print driver isn't aware of any changes you make to the PostScript imaging state.
The LaserWriter driver attempts to save and restore the graphics state around Postscript that you're sending to the printer, but there are cases when you can confuse it. In one case, for example, your app generates PostScript which prints to multiple pages without telling the driver. Another example would be changing the PostScript pen size directly rather than via QuickDraw. In general, if you are changing the state, you need to restore it.
QuickDraw, and the Printing manager only know about pages when you signal page boundaries by calling
What this means to you is that any PostScript you send using the
Following these guidelines will also help you avoid Gotcha #2.
Use the right method for sending an application-specific PostScript dictionary (a.k.a. prep).
Applications which do not use this resource not only keep the LaserWriter driver from optimizing the PostScript it generates, but also create compatibility problems for future versions of the LaserWriter driver.
Printing PostScript Files
If you want to print complete PostScript files to a PostScript printer, you should be using the PAP.WrkStation.o library, which is provided on the MacOS SDK CD. Sample code for using that library is in the works, and will appear on a future Developer CD.
The PostScriptHandle PicComment is your friend, but even as your friend, you need to be aware of its limitations.
Inside Macintosh: Imaging with QuickDraw , Appendix B
PostScript Language Reference Manual, 2nd Edition , Appendix H
Contact ADC | ADC Site Map | ADC Advanced Search
|For information about Apple Products, please visit Apple.com.|
Contact Apple | Privacy Notice
Copyright © 2002 Apple Computer, Inc. All rights reserved.