ADC Home > Reference Library > Technical Notes > Legacy Documents > Mac OS 9 & Earlier >

Legacy Documentclose button

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:

PrintMonitor Q&As

CONTENTS

This Technical Note contains a collection of archived Q&As relating to a specific topic--questions sent the Developer Support Center (DSC) along with answers from the DSC engineers. Current Q&A's can be found on the Macintosh Technical Q&A's web site.

[Oct 01 1990]






Determining whether background printing is enabled

62755 MD JM dy 1

Date Written: 1/20/93

Last reviewed: 4/26/93

How can I tell whether background printing is enabled for the selected printer?

There's no procedure to determine whether the user has picked background printing because that's not a standard Macintosh system software feature. Where it's done, it's implemented on a driver-by-driver basis, and each printer driver keeps track of it in a different way. Apple does it one way, Hewlett-Packard might do it another way, GCC a third way, and so on.

Since we don't actually know how it's done, and since Apple doesn't guarantee its drivers will do it the same way in the future as they do now, we have no information to give you on how to determine this. Sorry to be the bearer of bad news.

Back to top

Location for spool files under System 7.0

Date Written: 12/18/90

Last reviewed: 8/1/92

Is there a recommended location for printer driver writers to put their own spool files?

Place it in the "PrintMonitor Documents" folder within a "personal spool" folder. PrintMonitor will ignore other folders and it will delete its spool file when it was done with it.

The biggest advantage with this approach is that all the spool files end up in the same location, which is probably the best solution for the native user.

There are a few cases when the folder might not be present (such as if the user has deleted it for some reason). Therefore, you should check to make sure that the folder is present before trying to add a file to it. If it is not present, be sure to create it with the exact name; otherwise, PrintMonitor will not be able to find it and will create a second folder with a different name, possibly confusing the native user. Folder management is relatively straightforward with the addition of the "Folder Manager" to System 7.0. The Finder chapter in Inside Macintosh Volume VI contains the details about using it.

Back to top

Determining whether background printing is turned on

Date Written: 2/5/92

Last reviewed: 8/1/92

I need to know whether the currently chosen printer driver - that I'm about to print to--is going to be doing background printing or not. The user interface of our application is somewhat different, depending on this. Currently, I check the driver's file type to see whether it's network- or local-attached, generalizing "network = LaserWriter = background capable" and "direct = ImageWriter = foreground only," but I know this isn't always correct, because a variety of direct-connect printer drivers now support background printing. What I really need is a way to check specifically for background printing being turned on. Is there a safe and driver-independent way to check this?

No, there's absolutely no safe and driver-independent way to do this. Although Apple uses PrintMonitor for all background printing, it's not designed for third-party products to hook into it. The "background printing" internals aren't documented because changing that outside an individual printer driver may not give the driver all the information it needs to correctly print in the background. Also, third parties have to implement their own background printing schemes, and there's absolutely no way to know how they're storing the choice on whether or not to print in the background.

If your user interface is substantially different, you may need to require your users to enable background printing in your application as well as in the Chooser. This isn't exactly friendly, but since there's no mechanism for applications to communicate with printer drivers to find out about background printing, it's pretty much your only choice.

You're right, checking a driver's file type to see whether it's network- or local-attached is not a good solution. StyleWriters and LaserWriter LS printers print in the background but don't use a network. Some third-party laser printers support AppleTalk but not background printing.

Back to top

Turning Macintosh background printing on and off

Date Written: 3/25/92

Last reviewed: 6/14/93

Someone has requested that we do an extension for our application to turn background printing on and off. Can you tell me how to do this?

Unfortunately, DTS can't tell you how to turn background printing on and off, for the following reasons:

  1. Apple's mechanism for background printing (PrintMonitor) is at this time only available to Apple's printer drivers. How Apple's printer drivers store the background printing choice is private because Engineering has changed it in the past and might need to change it again.
  2. Since all third-party printer drivers that do background printing have to do it their own way, they all have to find their own ways of recording the "background printing" choice, such as storing the information in resources like the PAPA resource. Since there are no guidelines for recording background printing options, DTS cannot recommend a method which will work with all drivers.

For these reasons, and to avoid possible Human Interface conflicts, background printing control is best left to the user.

Back to top

Macintosh PicComments and background printing

Date Written: 5/3/89

Last reviewed: 6/14/93

My Macintosh application prints fine when Background Printing is disabled, but doesn't print or prints blank pages when Background Printing is enabled. Why?

The Printing Manager gets execution time by replacing the grafProcs of the Printing Manager GrafPort (returned from the PrOpenDoc call). This GrafPort is created by the PrOpenDoc call, and is reinitialized by every call to PrOpenPage. On the LaserWriter driver with Background Printing enabled, this reinitialization causes the clipping region of the port to be set to (0,0,0,0). On the next call to StdLine or StdText, for example, the Printing Manager notices the zeroed clipping region, and sets it to the rectangle specified by prInfo.rPage in the print record. If your application prints its documents with PostScript using PicComments, the Printing Manager never gets a chance to define the clipping region. All of your PostScript code is sent to the LaserWriter and executed, but the results are clipped to (0,0,0,0). To work around this problem, you must call at least one Quickdraw drawing routine at the beginning of each page. The following is frequently used:

    PrOpenPage(...);
    MoveTo(-32000, -32000);
    Line(0, 0);
    { PostScript code here }

The MoveTo is needed so that the line is drawn outside of the imageable area of the page, and thus is invisible. The Line call calls the Printing Manager's version of the StdLine procedure, which defines the clipping region for the port. All subsequent PostScript code will be clipped correctly. Since PrOpenPage resets the clipping region, the MoveTo/Line combination must be done after each call to PrOpenPage.

Back to top

SetOrigin and background printing

Date Written: 1/1/90

Last reviewed: 6/14/93

I have noticed PostScript graphics printing in different locations depending on whether or not Background printing is enabled on the Macintosh. What causes this?

In LaserWriter 4.0 - 5.2, SetOrigin is handled differently when Background printing is enabled. The method used by these drivers is described below:

Background Printing DISABLED: The application calls SetOrigin, and QuickDraw responds to the call by adjusting the portRect of the Print Manager's GrafPort. Since SetOrigin does not cause any grafProcs to run, the Printing Manager doesn't see this change until the next QuickDraw drawing operation such as DrawString or LineTo. At that time, the Printing Manager notices the change in the portRect, and updates its internal origin. All QuickDraw graphics are now localized to the new origin. All PostScript graphics will also get the localization to the new origin.

Background Printing ENABLED: Because QuickDraw is playing back a picture that was spooled earlier, it handles calls to SetOrigin a little differently. When the SetOrigin call is encountered in a DrawPicture call, the portRect of the GrafPort is NOT updated. Instead, QuickDraw keeps the current origin cached, and offsets each graphic on the fly. Since the portRect was not modified, the Printing Manager does not see the SetOrigin call. Although all QuickDraw objects are still localized correctly (by QuickDraw), PostScript graphics do not move to the new origin. Instead, the application localizes the coordinates of its PostScript graphics. You could also use the technique documented in the Technical Note "Position-Independent PostScript."

The implementation of the SetOrigin (IM I:166) and ClipRect (IM I:167) calls has been revised in LaserWriter 6.0. This is a general description of those changes:

LaserWriter 6.0: Both QuickDraw and PostScript coordinates are offset with respect to the origin set by SetOrigin. The driver now inserts a picture comment into the spool file so that the Print Monitor knows that the origin was changed during spooling.

Since applications must support versions of the LaserWriter driver other than 6.0, they should still use the method described in this Technote to make sure their PostScript is position-independent.

X-Ref:

DTS Macintosh Technical Note "Position-Independent PostScript"

Back to top

Macintosh spool file formats aren't available

Date Written: 1/1/90

Last reviewed: 8/1/92

What is file format of Macintosh Printing Manager and LaserShare spool files?

Unfortunately, the formats for these files are not currently available, and it is doubtful that they will be made available in the future. Whenever new features are added to LaserShare, the Printing Manager, or other parts of the Macintosh toolbox, it's not uncommon for these spool file formats to be affected. If the file format were published, and essentially frozen, it would be much harder for engineering to add features.



Back to top

Downloadables

Acrobat gif

Acrobat version of this Note (52K).

Download



Did this document help you?
Yes: Tell us what works for you.
It’s good, but: Report typos, inaccuracies, and so forth.
It wasn’t helpful: Tell us what would have helped.