ADC Home > Reference Library > Technical Notes > Legacy Documents > Printing >
Legacy Document
Important: This document is part of the Legacy section of the ADC Reference Library. This information should not be used for new development.
Current information on this Reference Library topic can be found here:
|
IntroductionAlthough the Printing Manager was originally designed to allow application code to be printer independent, there are some things about the LaserWriter that, in some cases, have to be addressed in a printer dependent way. This Note describes what the LaserWriter can and cannot do, memory considerations, speed considerations, as well as other things you need to watch out for if you want to make your printing more efficient on the LaserWriter. How To Determine The Currently Selected Printer
With the addition of new picture comments and the Even though there is no supported method for determining a device's type, there is one method described in the original Inside Macintosh that still works for ImageWriter and LaserWriter printer drivers. This method is not supported, meaning that at some point in the future it will no longer work. If you use this method in your application, it is up to you to weigh the value of the feature against the compatibility risk. The following method works for all ImageWriter, ImageWriter II, and LaserWriter (original, Plus, IINT, IINTX) drivers. Since all new devices released from Apple and third-party developers have their own unique ID, it is up to you to decide what to do with an ID that your application does not recognize.
If you are using the high-level Printing Manager interface, first call
Following is the current list of printer IDs: If you are using the low-level Printing Manager interface, there is no dependable way of getting the wDev information. You should not attempt to determine the device ID when using the low-level Printing Manager interface. Using QuickDraw With the LaserWriterWhen you print to the LaserWriter, all of the QuickDraw calls you make are translated (via QuickDraw bottlenecks) into PostScript, which is in the LaserWriter ROM. Most of the operations available in QuickDraw are available in PostScript, with a few exceptions. The LaserWriter driver does not support the following:
What You See Is Not Always What You GetUnfortunately, what you see on the screen is not always what you get. If you are using standard graphic objects, like rectangles, circles, etc., the object is the same size on the LaserWriter as it is on the screen. There are, however, two types of objects where this is not the case: text and bitmaps.
The earlier noted difference between the widths of characters on the screen and
the widths of characters on the printer is due to the difference in resolution.
However, to maintain the integrity of line breaks, the driver changes the word
and character spacing to maintain the end points of the lines as specified.
What this all means is that you cannot count on the positions or the widths of
printed characters being exactly the same as they are on the screen. This is
why in the original MacDraw, for example, if one
carefully places text and a rectangle and prints it, the text sometimes extends
beyond the bounds of the rectangle on the printed page. If an application does
its own line layout (i.e., positions the words on the line itself), then it may
want to disable the LaserWriter's line layout routines. To disable these
routines, use the
The sole exception to this rule is if an application is running on 128K ROMs or
later. The 128K ROM Font Manager supports the specification of fractional
pixel widths for screen fonts, increasing the screen to printer accuracy. This
fractional width feature is disabled by default. To enable it, an application
can use Applications can use picture comments to left-, right-, or center-justify text. Only the left, right, or center end points are accurate. If the text is fully justified, both end points are accurate. Technical Note #91, Optimizing for the LaserWriter--Picture Comments, discusses these picture comments. Memory ConsiderationsTo print to the LaserWriter, you need to make sure that you have enough memory available to load the driver's code. The best way to do this is to have all the code you need for printing in a separate segment and unload everything else. When you print to the LaserWriter you are only able to print in Draft mode. You are not able to spool (as the ImageWriter does in the standard or high-quality settings), and your print code, data, and the driver code have to be resident in memory.
In terms of memory requirements, there is not any magic number that always
works with all printer drivers (including third-party printer drivers) that are
available for the Macintosh. To make sure there is enough memory available
during print time, you should make your printing code a separate segment and
swap out all unwanted code and data before you call Printable Paper AreaOn the LaserWriter there is a 0.45-inch border that surrounds the printable area of the paper (this is assuming an 8.5" x 11" paper). If you select the "Larger Print Area" option in the Page Setup dialog box, the border changes to 0.25 of an inch. This printable area is different than the available print area of the ImageWriter. An application cannot print a larger area because of the memory PostScript needs to image a page. PostScript takes the amount of memory available in the printer and centers it on the paper, and there is not enough RAM in the LaserWriter to image an entire sheet of paper. Page SizesMany developers have expressed a desire to support page sizes other than those provided by the Apple printer drivers. Even though some devices can physically support other page sizes, there is no way for an application to tell the driver to use this size. With the ImageWriter driver, it is possible to modify certain fields in the print record and expand the printable area of the page. However, each of the Apple drivers implements the page sizes in a different way. No one method works for all drivers. Because of this difference, it is strongly recommended that applications do not attempt to change the page sizes provided in the "Style" dialog box. If your application currently supports page sizes other than those provided by the printer driver, you are taking a serious compatibility risk with future Apple and third-party printer drivers. Speed ConsiderationsAlthough the LaserWriter is relatively fast, there are some techniques an application can use to ensure its maximum performance:
Clipping Within Text StringsWhen clipping characters out of a string, make sure that the clipping rectangle or region is greater than the bounding box of the text you want to clip. The reason is that if you clip part of a character (e.g., a descender), the clipped character has to be rebuilt, which takes time. In addition, because of the difference between screen fonts and printer fonts, chances are that you cannot accurately clip the right characters unless you are running on the 128K ROMs and have fractional pixel widths enabled. When to Validate the Print Record
To validate the print record, call Empty QuickDraw ObjectsQuickDraw objects that are empty (i.e., they have no pixels in them) and are filled but not framed, do not print on the ImageWriter and do not show up on the screen; however, on the LaserWriter they are real objects and do print. ReferencesInside Macintosh, Volume I, QuickDraw Inside Macintosh, Volume II, The Printing Manager LaserWriter Reference Manual Technical Note M.IM.OffscreenBitMap-- Drawing Into An Off-Screen Bitmap Technical Note M.IM.gifComments -- Optimizing for the LaserWriter--Picture Comments Technical Note M.IM.Spooler -- Effect of Spool-A-Page/Print-A-Page on Shared Printers Technical Note M.IM.PrintLoop -- A Printing Loop That Cares... PostScript Language Reference, Adobe Systems, Incorporated PostScript Language Tutorial and Cookbook, Adobe Systems, Incorporated MacDraw is a registered trademark of Claris Corporation. PostScript is a registered trademark of Adobe Systems, Incorporated. Change History
Downloadables
|