[comp.lang.postscript] what am I printing on?

jwz@lucid.com (Jamie Zawinski) (11/03/90)

What's the best way for a PostScript program to tell what kind of device it's
printing on?  Basically, I would like a program to be able to notice that
it is running under GhostScript, for example, instead of on a LaserWriter
(Don't ask why...).  Probably the way to do this is to test for the existence
of certain dictionary entries; any suggestions as to which are the best ones
to look for?  (Remember that most previewers have a stubbed-out definition of
statusdict, so it's not a trivial problem.)

		-- Jamie

woody@chinacat.Unicom.COM (Woody Baker @ Eagle Signal) (11/04/90)

In article <JWZ.90Nov2114034@kolyma.lucid.com>, jwz@lucid.com (Jamie Zawinski) writes:
> What's the best way for a PostScript program to tell what kind of device it's
> printing on?  Basically, I would like a program to be able to notice that
Generaly, there is a command that will return the name of the printer to you.
The following facilities of statusdict are available to all Adobe postscript
interpreters according to the RED book, and so should be present on all
complient clones.    product <product name string>    revision <int revision
number>

These should suffice to allow you to determine these things.  for example,
assuming that GHOSTSCRIPT does not have it defined, if you do

do product, you may get an error.  Doing so on another machine will
get you a name.  Granted, the name can be changed, but still it should
suffice to know that a machine is NOT a laserwriter of you need to make
that determination.
Cheers
Woody