[comp.lang.postscript] Why won't this Windows 3.0 header print???

timur@seas.gwu.edu (The Time Traveler) (03/22/91)

The following postscript program is supposed to be the Windows 3.0
Postscript header for an Apple LaserWriter Plus.  For some reason, the
laserwriter prints out the file (i.e. it thinks it's not postscript).
Can anyone answer the following questions:

1. Does the Laserwriter Plus reject and print out a file if it thinks
   it's not a postscript program?
2. Is the following file a valid postscript program?  If not, why is
   Windows producing it, and how can I fix it?
3. If the program is valid, what am I doing wrong?

%%Page: 1 1
%%PageResources: (atend)
SS
0 0 0 0 0 0 SM
%!PS-Adobe-3.0
%%Creator: Windows PSCRIPT
%%Title: PSHeader
statusdict begin statusdict /jobname (PSHeader) put end
/Win33Dict where{pop(Windows PS Header in place - not loaded again\n)print flush 100 100 moveto/Helvetica findfont
20 scalefont setfont(Windows PS Header in place - not reloaded.)show showpage stop}{serverdict begin statusdict
begin 0000 checkpassword{(Windows PS Header downloaded.\n)print flush 0000 exitserver}{(Bad Password loading Header.\n)print flush
stop}ifelse}ifelse
/Win33Dict 290 dict def Win33Dict begin/bd{bind def}bind def/in{72
mul}bd/ed{exch def}bd/ld{load def}bd/tr/translate ld/gs/gsave ld/gr/grestore
ld/M/moveto ld/L/lineto ld/rmt/rmoveto ld/rlt/rlineto ld/rct/rcurveto
ld/st/stroke ld/n/newpath ld/sm/setmatrix ld/cm/currentmatrix ld/cp/closepath
ld/ARC/arcn ld/TR{65536 div}bd/lj/setlinejoin ld/lc/setlinecap ld/ml/setmiterlimit
ld/sl/setlinewidth ld/scignore false def/sc{scignore{pop pop pop}{0
index 2 index eq 2 index 4 index eq and{pop pop 255 div setgray}{3{255
div 3 1 roll}repeat setrgbcolor}ifelse}ifelse}bd/FC{bR bG bB sc}bd/fC{/bB
ed/bG ed/bR ed}bd/HC{hR hG hB sc}bd/hC{/hB ed/hG ed/hR ed}bd/PC{pR
pG pB sc}bd/pC{/pB ed/pG ed/pR ed}bd/sM matrix def/PenW 1 def/iPen
5 def/mxF matrix def/mxE matrix def/fBE false def/iDevRes 72 0 matrix
defaultmatrix dtransform dup mul exch dup mul add sqrt def/SS{/SV save
def}bd/RS{SV restore}bd/EJ{gsave showpage grestore}bd/#C{userdict begin/#copies
ed end}bd/SM{/iRes ed/cyP exch def/cxP exch def/cyM exch def/cxM exch
def 72 iRes div dup neg scale 0 ne{cyP cxP neg tr 90 rotate cxM cyM}{cxM
cyM cyP sub}ifelse tr 0 0 transform .25 add round .25 sub exch .25
add round .25 sub exch itransform translate}bd/SJ{1 index 0 eq{pop
pop/fBE false def}{1 index/Break ed div/dxBreak ed/fBE true def}ifelse}bd/ANSIVec[
16#0/grave 16#1/acute 16#2/circumflex 16#3/tilde 16#4/macron 16#5/breve
16#6/dotaccent 16#7/dieresis 16#8/ring 16#9/cedilla 16#A/hungarumlaut
16#B/ogonek 16#C/caron 16#D/dotlessi 16#27/quotesingle 16#60/grave
16#7C/bar 16#91/quoteleft 16#92/quoteright 16#93/quotedblleft 16#94/quotedblright
16#95/bullet 16#96/endash 16#97/emdash 16#A0/space 16#A4/currency 16#A6/brokenbar
16#A7/section 16#A8/dieresis 16#A9/copyright 16#AA/ordfeminine 16#AB/guillemotleft
16#AC/logicalnot 16#AD/hyphen 16#AE/registered 16#AF/macron 16#B0/degree
16#B1/plusminus 16#B2/twosuperior 16#B3/threesuperior 16#B4/acute 16#B5/mu
16#B6/paragraph 16#B7/periodcentered 16#B8/cedilla 16#B9/onesuperior
16#BA/ordmasculine 16#BB/guillemotright 16#BC/onequarter 16#BD/onehalf
16#BE/threequarters 16#BF/questiondown 16#C0/Agrave 16#C1/Aacute 16#C2/Acircumflex
16#C3/Atilde 16#C4/Adieresis 16#C5/Aring 16#C6/AE 16#C7/Ccedilla 16#C8/Egrave
16#C9/Eacute 16#CA/Ecircumflex 16#CB/Edieresis 16#CC/Igrave 16#CD/Iacute
16#CE/Icircumflex 16#CF/Idieresis 16#D0/Eth 16#D1/Ntilde 16#D2/Ograve
16#D3/Oacute 16#D4/Ocircumflex 16#D5/Otilde 16#D6/Odieresis 16#D7/multiply
16#D8/Oslash 16#D9/Ugrave 16#DA/Uacute 16#DB/Ucircumflex 16#DC/Udieresis
16#DD/Yacute 16#DE/Thorn 16#DF/germandbls 16#E0/agrave 16#E1/aacute
16#E2/acircumflex 16#E3/atilde 16#E4/adieresis 16#E5/aring 16#E6/ae
16#E7/ccedilla 16#E8/egrave 16#E9/eacute 16#EA/ecircumflex 16#EB/edieresis
16#EC/igrave 16#ED/iacute 16#EE/icircumflex 16#EF/idieresis 16#F0/eth
16#F1/ntilde 16#F2/ograve 16#F3/oacute 16#F4/ocircumflex 16#F5/otilde
16#F6/odieresis 16#F7/divide 16#F8/oslash 16#F9/ugrave 16#FA/uacute
16#FB/ucircumflex 16#FC/udieresis 16#FD/yacute 16#FE/thorn 16#FF/ydieresis
] def/reencdict 12 dict def/IsChar{basefontdict/CharStrings get exch
known}bd/MapCh{dup IsChar not{pop/bullet}if newfont/Encoding get 3
1 roll put}bd/MapDegree{16#b0/degree IsChar{/degree}{/ring}ifelse MapCh}bd/MapBB{16#a6/brokenbar
IsChar{/brokenbar}{/bar}ifelse MapCh}bd/ANSIFont{reencdict begin/newfontname
ed/basefontname ed FontDirectory newfontname known not{/basefontdict
basefontname findfont def/newfont basefontdict maxlength dict def basefontdict{exch
dup/FID ne{dup/Encoding eq{exch dup length array copy newfont 3 1 roll
put}{exch newfont 3 1 roll put}ifelse}{pop pop}ifelse}forall newfont/FontName
newfontname put 127 1 159{newfont/Encoding get exch/bullet put}for
ANSIVec aload pop ANSIVec length 2 idiv{MapCh}repeat MapDegree MapBB
newfontname newfont definefont pop}if newfontname end}bd/SB{FC/str
ed str length fBE not{dup 1 gt{1 sub}if}if/cbStr ed/dxGdi ed/y0 ed/x0
ed str stringwidth esc 0 ne{mxE itransform exch neg dxGdi add cbStr
div exch mxE transform}{exch neg dxGdi add cbStr div exch}ifelse/dyExtra
ed/dxExtra ed x0 y0 M fBE{dxBreak 0 BCh dxExtra dyExtra str awidthshow}{dxExtra
dyExtra str ashow}ifelse fUL{x0 y0 M dxUL dyUL rmt dxGdi fBE{Break
add}if 0 mxE transform rlt cyUL sl st}if fSO{x0 y0 M dxSO dySO rmt
dxGdi fBE{Break add}if 0 mxE transform rlt cyUL sl st}if n/fBE false
def}bd/font{/name ed/Ascent ed 0 ne/fSO ed 0 ne/fUL ed/Sy ed/Sx ed
10.0 div/ori ed -10.0 div/esc ed/BCh ed name findfont [Sx 0 0 Sy neg
0 Ascent] esc mxE rotate mxF concatmatrix makefont setfont fUL{currentfont
dup/FontInfo get/UnderlinePosition known not{pop/Courier findfont}if/FontInfo
get/UnderlinePosition get 1000 div 0 exch mxF transform/dyUL ed/dxUL
ed}if fSO{0 .3 mxF transform/dySO ed/dxSO ed}if fUL fSO or{currentfont
dup/FontInfo get/UnderlineThickness known not{pop/Courier findfont}if/FontInfo
get/UnderlineThickness get 1000 div Sy mul/cyUL ed}if}bd/min{2 copy
gt{exch}if pop}bd/max{2 copy lt{exch}if pop}bd/CP{/ft ed{{ft 0 eq{clip}{eoclip}ifelse}stopped{currentflat
1 add setflat}{exit}ifelse}loop}bd/patfont 10 dict def patfont begin/FontType
3 def/FontMatrix [1 0 0 -1 0 0] def/FontBBox [0 0 32 32] def/Encoding
StandardEncoding def/BuildChar{pop pop 32 0 0 0 32 32 setcachedevice
2 2 scale 16 16 false [1 0 0 1 .25 .25]{pat}imagemask}bd end/p{/pat
32 string def{}forall 0 1 7{dup 2 mul pat exch 3 index put dup 2 mul
1 add pat exch 3 index put dup 2 mul 16 add pat exch 3 index put 2
mul 17 add pat exch 2 index put pop}for}bd/pfill{/PatFont patfont definefont
setfont/ch(AAAA)def X0 128 X1{Y1 -32 Y0{1 index exch M ch show}for pop}for}bd/vert{X0
w X1{dup Y0 M Y1 L st}for}bd/horz{Y0 w Y1{dup X0 exch M X1 exch L st}for}bd/fdiag{X0
w X1{Y0 M X1 X0 sub dup rlt st}for Y0 w Y1{X0 exch M Y1 Y0 sub dup
rlt st}for}bd/bdiag{X0 w X1{Y1 M X1 X0 sub dup neg rlt st}for Y0 w
Y1{X0 exch M Y1 Y0 sub dup neg rlt st}for}bd/AU{1 add cvi 15 or}bd/AD{1
sub cvi -16 and}bd/SHR{pathbbox AU/Y1 ed AU/X1 ed AD/Y0 ed AD/X0 ed}bd/hfill{2
sl [] 0 setdash n/w iRes 20 div 8 div round 8 mul def dup 0 eq{horz}if
dup 1 eq{vert}if dup 2 eq{fdiag}if dup 3 eq{bdiag}if dup 4 eq{horz
vert}if 5 eq{fdiag bdiag}if}bd/F{/ft ed fm 256 and 0 ne{gs FC ft 0
eq{fill}{eofill}ifelse gr}if fm 1536 and 0 ne{SHR gs HC ft CP fm 1024
and 0 ne{/Tmp save def pfill Tmp restore}{fm 15 and hfill}ifelse gr}if}bd/S{PenW
sl PC st}bd/m matrix def/GW{iRes 12 div PenW add cvi}bd/DoW{iRes 50
div PenW add cvi}bd/DW{iRes 8 div PenW add cvi}bd/SP{/PenW ed/iPen
ed iPen 0 eq{[] 0 setdash}if iPen 1 eq{[DW GW] 0 setdash}if iPen 2
eq{[DoW GW] 0 setdash}if iPen 3 eq{[DW GW DoW GW] 0 setdash}if iPen
4 eq{[DW GW DoW GW DoW GW] 0 setdash}if}bd/E{m cm pop tr scale 0 0
1 0 360 arc cp m sm}bd/AG{/sy ed/sx ed sx div 4 1 roll sy div 4 1 roll
sx div 4 1 roll sy div 4 1 roll atan/a2 ed atan/a1 ed sx sy scale a1
a2 ARC}def/A{m cm pop tr AG m sm}def/P{m cm pop tr 0 0 M AG cp m sm}def/RRect{n
4 copy M 3 1 roll exch L 4 2 roll L L cp}bd/RRCC{/r ed/y1 ed/x1 ed/y0
ed/x0 ed x0 r add y0 M x1 y0 x1 y1 r arcto 4{pop}repeat x1 y1 x0 y1
r arcto 4{pop}repeat x0 y1 x0 y0 r arcto 4{pop}repeat x0 y0 x1 y0 r
arcto 4{pop}repeat cp}bd/RR{2 copy 0 eq exch 0 eq or{pop pop RRect}{2
copy eq{pop RRCC}{m cm pop/y2 ed/x2 ed/ys y2 x2 div 1 max def/xs x2
y2 div 1 max def/y1 exch ys div def/x1 exch xs div def/y0 exch ys div
def/x0 exch xs div def/r2 x2 y2 min def xs ys scale x0 r2 add y0 M
x1 y0 x1 y1 r2 arcto 4{pop}repeat x1 y1 x0 y1 r2 arcto 4{pop}repeat
x0 y1 x0 y0 r2 arcto 4{pop}repeat x0 y0 x1 y0 r2 arcto 4{pop}repeat
m sm cp}ifelse}ifelse}bd/PP{{rlt}repeat}bd/OB{gs sc B fill gr}bd/B{M/dy
ed/dx ed dx 0 rlt 0 dy rlt dx neg 0 rlt cp}bd/CB{B clip n}bd
end/Helvetica findfont 20 scalefont setfont 100 100 moveto(Windows PostScript header loaded.)show showpage
quit

brown@vidiot.UUCP (Vidiot) (03/22/91)

In article <2908@sparko.gwu.edu> timur@seas.gwu.edu () writes:
<The following postscript program is supposed to be the Windows 3.0
<Postscript header for an Apple LaserWriter Plus.  For some reason, the
<laserwriter prints out the file (i.e. it thinks it's not postscript).
<Can anyone answer the following questions:
<
<1. Does the Laserwriter Plus reject and print out a file if it thinks
<   it's not a postscript program?
<2. Is the following file a valid postscript program?  If not, why is
<   Windows producing it, and how can I fix it?
<3. If the program is valid, what am I doing wrong?

%%Page: 1 1
%%PageResources: (atend)
SS
0 0 0 0 0 0 SM
%!PS-Adobe-3.0

Well, it works for me, IF you remove the first four lines of crap.  If the
file is going through a UNIX print spooler, the spooler doesn't see the
%! as the first part of the file and sends it through a text to PS converter.
That is if your system has that kind of support.  If you are sending the file
to the printer attached to a PC, then that won't be a problem, but the SS and
SM will.  Those procedures aren't even defined yet.  The printer will barf
and ignor the rest of the job.

I have no idea why they are there.  But remove them and it printed out a
little message on my Apple LaserWriter IINT about the Windows PostScript
header being loaded.
-- 
      harvard\     att!nicmad\          spool.cs.wisc.edu!astroatc!vidiot!brown
Vidiot  ucbvax!uwvax..........!astroatc!vidiot!brown
      rutgers/  decvax!nicmad/ INTERNET:vidiot!brown%astroatc@spool.cs.wisc.edu