[comp.sys.mac.programmer] Background-printing problem while using raw PostScript

dplatt@coherent.com (Dave Platt) (12/01/88)

I've encountered an interesting little problem, which may indicate the
presence of a bug of some sort in the LaserWriter driver or in the
background-printing code in PrintMonitor.  It might also indicate a bug
or incompatibility in my code;  I'm not certain.

Here's the background.  I have a program that creates fractal images,
and displays them in any of several formats: monochrome, patterned-pen,
old-style 6-color QuickDraw, or Color QuickDraw.  I've been adding code
to support printing.

The main "Print file" routine has some special-case code that's executed
if [1] the data being printed is currently being displayed in Color
QuickDraw mode, and [2] the top byte of the wDev field in the print
record's style subrecord contains 3 ("LaserWriter").  Instead of drawing
the image using QuickDraw, this code instructs the driver to switch over
to raw PostScript mode ("PostScriptBegin" and "TextIsPostScript"
PicComments), sets up a PostScript "image" operation, and sends the data
down to the printer as a series of bytes that are read and processed by
the "readhexstring" operator.  When the end of the image is reached, a
"PostScriptEnd" PicComment is sent to reset the driver, and the current
page is closed.

This procedure works perfectly in two cases, and fails in a third:

1) It works perfectly if the LaserWriter driver sends the PostScript
   data directly to the printer (background printing off) 

2) It works perfectly if I capture the PostScript text (via command-F)
   and then download the PostScript to the printer from a Sun workstation
   (using "lpr") or from the Mac (using the LaserStatus DA)

3) It fails completely if the image is spooled by LaserWriter driver, and
   sent to the printer by PrintMonitor.

PrintMonitor never reports an error of any sort... it chugs happily
along, preparing and transmitting lots of data, while showing a status
of "Preparing data" in its window.  However, when it reaches the
end-of-data, the printer spits out a completely blank page.

It does not appear to matter whether the LaserWriter is set up for
portrait or landscape layouts... I get a nicely centered image if I
print directly, or capture and download the PostScript file, and a
completely blank page if I let PrintMonitor send the data.

Does this ring any bells for anybody?
-- 
Dave Platt    FIDONET:  Dave Platt on 1:204/444        VOICE: (415) 493-8805
  UUCP: ...!{ames,sun,uunet}!coherent!dplatt     DOMAIN: dplatt@coherent.com
  INTERNET:   coherent!dplatt@ames.arpa,    ...@sun.com,    ...@uunet.uu.net 
  USNAIL: Coherent Thought Inc.  3350 West Bayshore #205  Palo Alto CA 94303