Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!zephyr.ens.tek.com!orca.wv.tek.com!pogo!kevind From: kevind@pogo.WV.TEK.COM (Kevin Draz) Newsgroups: comp.lang.postscript Subject: Re: Detecting color printer Message-ID: <11108@pogo.WV.TEK.COM> Date: 21 Jun 91 01:17:09 GMT References: <1991Jun20.053653.20412@sci.ccny.cuny.edu> Reply-To: kevind@pogo.WV.TEK.COM (Kevin Draz) Organization: Tektronix, Inc., Wilsonville, OR. Lines: 36 In article <1991Jun20.053653.20412@sci.ccny.cuny.edu> kly@sci.ccny.cuny.edu (Gregory Kozlovsky) writes: > >I would like to create a Postscript file which would be printed >differently on color and black&white printers. For example, lines >which have different colors on a color printer should be drawn with >different dash patterns on black&white one. What is the correct way >to ask the printer? I would prefer not to use level 2 features. > > Gregory Version 49 and later of PS have an operator in statusdict called "processcolors" which return the number of primary colors known to the printer at that moment. For most printers it is 1=monochrome, 3=CMY, 4=CMYK. This would depend, for example, on the type of transfer ribbon loaded in a thermal-wax printer. Although possible, I've never seen a value other than 1, 3, or 4. Only 49.0 and later PS versions implement color extension to level 1 PS. Therefore: /hascolor { statusdict /processcolors known { statusdict /processcolors get exec 1 ne } { false } ifelse } def Defines a procedure "hascolor" which returns a boolean "true" if more than one color is known to the printer, i.e. CMY or CMYK, and false if the PS version is too early for color, or is a late version of a monochrome device. -- ---- kevind@pogo.wv.tek.com | For most software publishers, quality is job 1.01. Tektronix Color Printers| -- MacWeek Magazine