[comp.sys.mac.system] Printing questions...

yossie@fnal.fnal.gov (Yossie Silverman) (01/31/91)

Hi, I am trying to print from an XCMD.  I have found what seems to be a 
bug in the LaserWriter driver.

IM I claims that you cannot create a picture while printing a PAGE, it 
says nothing about doing so between PrOpenDoc and PrCloseDoc.  Well, it 
turns out that most printer drivers follow this rule, I.e. creating 
pictures is ok between pages, in a doc, but the LaserWriter doesn't.  My 
solution was to create another port, make the picture in it, and simply 
switch back and forth whenever necessary.  I am curious to know if I 
misread the documentation or is this really a bug.

Another question.  Where in hell are PREC's stored?  Basically I want to 
use the PageSetup information from HyperCard in my XCMD.  BUT, when I Page 
Setup to LandScape (which is really the only thing I want to have set) in 
HyperCard, it remembers this, but when I PrDefault in the XCMD, I get 
Portrait mode.  If I could reliably set LandScape mode, from within the 
XCMD, I wouldn't worry about it, but since it seems I can't, I need a way 
to get at the HyperCard settings.  Basically I don't want to put up a Page 
Setup dialog from the XCMD every time.  Currently my method is pretty 
ugly, I just created a PREC 1001 resource containing a Print Record with 
LandScape set up and I just fetch it in the XCMD and use it as is.

Thanks in advance - Cheers - Yossie


---

yossie@fnal.fnal.gov; yossie@fnccf.bitnet
What did the Caspian Sea? - Saki

wieser@fsd.cpsc.ucalgary.ca (Bernhard Wieser) (02/01/91)

Hi.  Take it from someone doing this stuff:  don't play with fire.
A PREC is a print record stored with the driver.  EACH DRIVER USES
DIFFERENT FIELDS IN THE PREC FOR DIFFERENT THINGS.  There is no
uniformity.  Get the document 'Learning to Drive' from AppleLink
(so I'm told).

Quickdraw is not re-entrant.  Most drivers spool by patching QDprocs
and using openpicture/close picture.  You definitly should NOT do this from
your printing port.  If low memory globals are used (they might be),
even using another port might be dangerous.

ANyone else got an opinion?

-- 
(    Bernie Wieser, wieser@cpsc.ucalgary.ca, BSWieser@uncamult.BITNET    )
(    4rth Year Dbl.Mgr Cpsc Clhc University of Calgary     |             )
(    S/H Developer Dept. of Psychology, "   "   "         \|/            )
(    Octavian Micro Development Group                  --- o ---         )

casseres@apple.com (David Casseres) (02/05/91)

In article <1991Jan31.160516.19607@cpsc.ucalgary.ca> 
wieser@fsd.cpsc.ucalgary.ca (Bernhard Wieser) writes:
> A PREC is a print record stored with the driver.  EACH DRIVER USES
> DIFFERENT FIELDS IN THE PREC FOR DIFFERENT THINGS.  There is no
> uniformity.

Well, there's some, as documented in Inside Mac.  But the basic point is 
correct.  The PREC resource type is reserved for use by printing drivers, 
so if the application has them too the driver will see them and may become 
confused.  However, nothing prevents you from storing print records as 
resources with some other, non-reserved type.  Drivers remember previously 
used print records in PREC resources, but you have no way of knowing 
exactly when a given PREC in the driver is valid and consistent, so don't 
try to use the driver's PRECs.  Store print records yourself when you want 
to remember them; the best way to store them depends on exactly what 
you're trying to do.  Always get the driver to validate a stored print 
record before you use it.

David Casseres
     Exclaimer:  Hey!