[comp.sys.mac.programmer] Capturing ASCII PostScript programatically?

kent@lloyd.camex.uucp (Kent Borg) (04/13/89)

Though the question still comes up weekly, we all pretty much know how
the *user* can get PostScript output sent to a file rather than the
LaserWriter, but is there a way for a *program* to do it?

Is there a way for a program to get Apple's LaserWriter driver to
convert QuickDraw calls to a file of ASCII PostScript?

I see about 4 ways: 1) find the hidden bit that tells the LaserWriter
driver to do that (I hope, I hope...), 2) fake-out the driver with a
synthetic LaserWriter--either in the same Mac, or in another machine
on the net (sounds like a lot of work, but could even be
Chooser-friendly), 3) pretend to be the user and do the command-K
business (sounds terrible, but might not be *that* bad), and 4) write
my own driver which does this (cheating--avoids the question, and too
much work).

Anybody think of any more?  Any good ideas on how to do one of these?

Thanks,

Kent Borg
kent@lloyd.uucp
or
...!hscfvax!lloyd!kent

olson@endor.harvard.edu (Eric K. Olson) (04/17/89)

In a recent article Kent Borg writes:
>Though the question still comes up weekly, we all pretty much know how
>the *user* can get PostScript output sent to a file rather than the
>LaserWriter, but is there a way for a *program* to do it?
>
>I see about 4 ways: 1) find the hidden bit that tells the LaserWriter
>driver to do that (I hope, I hope...), 2) fake-out the driver with a
>synthetic LaserWriter--either in the same Mac, or in another machine
>on the net (sounds like a lot of work, but could even be
>Chooser-friendly), 3) pretend to be the user and do the command-K
>business (sounds terrible, but might not be *that* bad), and 4) write
>my own driver which does this (cheating--avoids the question, and too
>much work).

I looked into this once and found that the Laserwriter print routines
check for command-K and command-F by looking at the boolean array returned
by GetKeys() [IM I-259].  In fact, it doesn't check the command key, so
just hitting K or F works too.

It's not very Mac-like, is it?  Perhaps if you patch GetKeys, you can
convince it to dump Postscript files.  The check might be between
PrJobDialog() and the time you get control back, so you'll have to avoid
messing up normal keyboard activity with the patch.  I'm not sure
GetKeys() is used by the event manager, though.

Good Luck!

-Eric


          Lexington Software Design:  Tomorrow's Software Yesterday

      Eric K. Olson     olson@endor.harvard.edu     harvard!endor!olson
         (Name)                (Arpanet)                 (Usenet)