[comp.sys.ibm.pc] DOS programs and PostScript

geertj@nlgvax.UUCP (Geert Jan de Groot) (02/15/89)

[Previously by accident posted in the wrong group. Please note followup-to]

Hi,

I would like to start a discussion on use of the PostScript language by
DOS programs. While PostScript has the ability to build a real portable
printer interface, most programs use some fancy method which may give
trouble connecting a printer (for instance, laserwriter plus).

Such neat setups may work with a printer directly connected to the PC
(but need special drivers - horror stories on that?), but if one connects 
a printer via a network (I use PC-NFS, allows sharing of the not-so-cheap
printer), those methods fail badly.

What should portable postscript code look like? In my opinion, it should:

 - Not use control characters, only CR, LF. Especially, no control-C,
   control-D, control-U and the like. These control-characters are likely
   to screw up a printer spooler, like SUNOS.

 - Not use 8-bit characters. Not every connection is 8-bit; why should one
   need 8-bit characters anyway?

 - Start with '%!'. This will trigger newer software that a PostScript
   file follows. This allows mixing of PostScript with other types of 
   files. Because % starts a comment, there is no reason to omit this
   lead-in.

 - End with 'showpage'. What's the use of sending data without giving
   the command to print it?

 - Not depend on sending some init data to the printer when the program
   starts, but send all data (including PostScript lead-ins et all)
   one after another for each job. Sending init only at the start of
   a program gives trouble with spooled jobs (i.e. other data being 
   printed between the init code and the output of a program).

 - Not leave resident code behind after the job is done.


Because I find most PostScript support available on update disks and
add-on packs and new versions, I think most software houses are just 
beginning using PostScript. With this article I hope to start a 
discussion on guidelines how things can be done, something which can 
be easily added while the PostScript support is still under development.

Also, what packages already use clean PostScript these days? I tried
WordPerfect, Lotus 123, ORCAD, ChiWrite, but they all gave more or
less trouble with the points mentioned above. How about other packages?

Thanks,

Geert Jan

_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._.

Geert Jan de Groot,			Email: geertj@nlgvax.pcg.philips.nl
Philips Research Laboratories,		       ..!mcvax!nlgvax!geertj
Project Centre Geldrop,			Packet: PE1HZG @ PI8ZAA
Building XR, Room 15,
Willem Alexanderlaan 7B,		"MS-DOS is just a bootstrap" - me
5664 AN Geldrop, The Netherlands.
phone: +31 40 892204			[Standard disclaimers apply]

phil@diablo.amd.com (Phil Ngai) (02/16/89)

In article <206@nlgvax.UUCP> geertj@nlgvax.UUCP (Geert Jan de Groot) writes:
|WordPerfect, Lotus 123, ORCAD, ChiWrite, but they all gave more or

I have used ORCAD with PC-NFS running a Laserwriter and it seems to
print fine for me. (did you know you can make the LW run at 38.4K?)

Microsloth Word, on the other hand, is nothing but trouble.

--
Phil Ngai, phil@diablo.amd.com		{uunet,decwrl,ucbvax}!amdcad!phil
"In Texas, they run the red light after it turns red."
"In Taiwan, they run the red light before it turns green."

izumi@violet.berkeley.edu (Izumi Ohzawa) (02/16/89)

In article <24456@amdcad.AMD.COM> phil@diablo.AMD.COM (Phil Ngai) writes:
>In article <206@nlgvax.UUCP> geertj@nlgvax.UUCP (Geert Jan de Groot) writes:
>|WordPerfect, Lotus 123, ORCAD, ChiWrite, but they all gave more or
>
>I have used ORCAD with PC-NFS running a Laserwriter and it seems to
>print fine for me. (did you know you can make the LW run at 38.4K?)
>
>Microsloth Word, on the other hand, is nothing but trouble.

There indeed was a real problem with MS WORD version 3.xx.

However, we have no trouble sending Word Version 4.0 output
via PC Network server to Apple LaserWriter.  We had to make a
little patch to POSTSCRx.INI by commenting out the line which says:

serverdict begin 0 exitserver

This way, Word jobs will not store anything permanently in LW.
And subsequent other jobs will have the full VM of LW.
This works because WORD V4.0 sends POSTSCRx.INI file each time it
prints something.

Word V3.xx apparently tried to save a little time by sending the
equivalent .INI file only once the first time.

Izumi Ohzawa
izumi@violet.berkeley.edu

phil@diablo.amd.com (Phil Ngai) (02/17/89)

In article <20446@agate.BERKELEY.EDU> izumi@violet.berkeley.edu (Izumi Ohzawa) writes:
|There indeed was a real problem with MS WORD version 3.xx.
|
|However, we have no trouble sending Word Version 4.0 output
|via PC Network server to Apple LaserWriter.  We had to make a
|little patch to POSTSCRx.INI by commenting out the line which says:
|
|serverdict begin 0 exitserver
|
|This way, Word jobs will not store anything permanently in LW.
|And subsequent other jobs will have the full VM of LW.
|This works because WORD V4.0 sends POSTSCRx.INI file each time it
|prints something.
|
|Word V3.xx apparently tried to save a little time by sending the
|equivalent .INI file only once the first time.

I'm using Word 4.0 with PC-NFS and it does not work reliably for me.
It may be that PC Network acts differently from PC-NFS. Also, I tend
to print by outputting to a file and then using PC-NFS "net print".
Word does not seem to put on the .ini file when it prints to a file.
Perhaps 4.0 does when printing to a printer but not a file? 

--
Phil Ngai, phil@diablo.amd.com		{uunet,decwrl,ucbvax}!amdcad!phil
"In Texas, they run the red light after it turns red."
"In Taiwan, they run the red light before it turns green."

les@chinet.chi.il.us (Leslie Mikesell) (02/18/89)

In article <24469@amdcad.AMD.COM> phil@diablo.AMD.COM (Phil Ngai) writes:

>Word does not seem to put on the .ini file when it prints to a file.
>Perhaps 4.0 does when printing to a printer but not a file? 

Yes, I have observed that to be the case by looking at the output
sent to the network print spooler.

Les Mikesell

cramer@optilink.UUCP (Clayton Cramer) (02/22/89)

In article <24469@amdcad.AMD.COM>, phil@diablo.amd.com (Phil Ngai) writes:
> In article <20446@agate.BERKELEY.EDU> izumi@violet.berkeley.edu (Izumi Ohzawa) writes:
> I'm using Word 4.0 with PC-NFS and it does not work reliably for me.
> It may be that PC Network acts differently from PC-NFS. Also, I tend
> to print by outputting to a file and then using PC-NFS "net print".
> Word does not seem to put on the .ini file when it prints to a file.
> Perhaps 4.0 does when printing to a printer but not a file? 
> 
> Phil Ngai, phil@diablo.amd.com		{uunet,decwrl,ucbvax}!amdcad!phil

You are correct.  The .INI file is not printed to a disk file, only
the printer.  Some changes to the .INI file are required to make Word
4.0 print through PC-NFS directly, but it does work.  I use it all
the time.

Here's the POSTSCRP.INI file I use with PC-NFS:
(Note the change at the first line is to make the print server recognize
this as PostScript).  Note also that there's no control-D at the start of
the file.

==cut here====================================================================
%! PostScript
% userdict /msdict known {stop} if
% serverdict begin 0 exitserver
/msdict 100 dict def
/mslinedraw 25 dict def
/PSl {msdict begin /ptop 792 def /sw 0 def 
 /ftsz 12 def /smode 0 def /STh -3.6 def /fs 0 def /offset 0 def
  fonttable 1 get fontset E 
  90 rotate 0 -612 translate save statusdict begin /waittimeout 360 def end} def
/PSp {msdict begin /ptop 792 def /sw 0 def 
 /ftsz 12 def /smode 0 def /STh -3.6 def /fs 0 def /offset 0 def
  fonttable 1 get fontset E save statusdict begin /waittimeout 360 def end} def
mslinedraw begin
/FontType 3 def
/FontMatrix [1.0 30.0 div 0 0 1.0 30.0 div 0 0] def
/FontBBox [0 0 18 30] def
/Encoding 256 array def
0 1 255 {Encoding exch /.notdef put} for
Encoding 45 [
 /sh   /sh   /sh /light /med /dark
 /sv   /srj  /sdjr /dsjr /sdtr /dstr /djr  /dv  
 /dtr  /dbr  /sdbr /dsbr /str  /sbl  /sjb  /sjt 
 /sjl  /sh   /sjc  /sdjl /dsjl /dbl  /dtl  /djb
 /djt  /djl  /dh   /djc  /dsjb /sdjb /dsjt /sdjt
 /sdbl /dsbl /dstl /sdtl  /sdjc /dsjc /sbr  /stl
 /black /bb /bl /br /bt] putinterval

/a {moveto lineto stroke} def
/b {moveto lineto lineto stroke} def
/c {moveto 9 7 lineto stroke} def
/d {moveto lineto lineto} def
/e {lineto closepath fill} def
/f {7 30 7 9 0 9 b} def
/g {12 30 12 9 18 9 b} def
/h {7 0 7 5 0 5 b} def
/i {12 0 12 5 18 5 b} def
/j {0 7 18 7 a} def
/k {9 30 9 0 a} def
/l {0 5 18 5 a 0 9 18 9 a} def
/m {7 30 7 0 a 12 30 12 0 a} def
/n {0 0 18 0 18 30 d 0 30 e} def

/CharProcs 55 dict def
CharProcs begin
/.notdef {} def
/sv {k} def
/srj {k 0 7 c} def
/sdjr {k 0 5 9 5 a 0 9 9 9 a} def
/dsjr {m 0 7 7 7 a} def
/sdtr {0 7 12 7 12 0 b 7 7 7 0 a} def
/dstr {0 9 9 9 9 0 b 0 5 9 5 a} def
/djr {f h 12 0 12 30 a} def
/dv {m} def
/dtr {h 0 9 12 9 12 0 b} def
/dbr {f  0 5 12 5 12 30 b} def
/sdbr {0 7 12 7 12 30 b 7 7 7 30 a} def
/dsbr {0 5 9 5 9 30 b 0 9 9 9 a} def
/str {0 7 9 7 9 0 b} def
/sbl {9 30 9 7 18 7 b} def
/sjb {j 9 30 c} def
/sjt {j 9 0 c} def
/sjl {k 18 7 c} def
/sh {j} def
/sjc {j k} def
/sdjl {k 9 9 18 9 a 9 5 18 5 a} def
/dsjl {m 12 7 18 7 a} def
/dbl {g 7 30 7 5 18 5 b} def
/dtl {i 7 0 7 9 18 9 b} def
/djb {f g 0 5 18 5 a} def
/djt {h i 0 9 18 9 a} def
/djl {g i 7 0 7 30 a} def
/dh {l} def
/djc {f g h i} def
/dsjb {l 9 30 9 9 a} def
/sdjb {j 7 7 7 30 a 12 7 12 30 a} def
/dsjt {l 9 0 9 5 a} def
/sdjt {j 7 7 7 0 a 12 7 12 0 a} def
/sdbl {7 30 7 7 18 7 b 12 30 12 7 a} def
/dsbl {9 30 9 5 18 5 b 9 9 18 9 a} def
/dstl {9 0 9 9 18 9 b 9 5 18 5 a} def
/sdtl {7 0 7 7 18 7 b 12 0 12 7 a} def
/sdjc {m j} def
/dsjc {l k} def
/sbr {0 7 9 7 9 30 b} def
/stl {9 0 9 7 18 7 b} def
/light {0.75 setgray n} def
/med {0.50 setgray n} def
/dark {0.30 setgray n} def
/black {n} def
/bt {0 7 18 7 18 30 d 0 30 e} def
/bb {0 0 18 0 18 7 d 0 7 e} def
/bl {0 0 9 0 9 30 d 0 30 e} def
/br {9 0 18 0 18 30 d 9 30 e} def
end %CharProcs

/BuildChar
  { fs 1 and 0 eq {1} {3} ifelse setlinewidth
    18 0 setcharwidth
    exch begin
      Encoding exch get
      CharProcs exch get
      exec
    end
  } def
end %mslinedraw
FontDirectory /LineDraw known not
   {/LineDraw mslinedraw definefont pop} if

msdict begin
/fonttable
  [0 [/Courier-Foreign /Courier-Bold-Foreign /Courier-Oblique-Foreign /Courier-BoldOblique-Foreign]
   8 [/Helvetica-Foreign /Helvetica-Bold-Foreign /Helvetica-Oblique-Foreign /Helvetica-BoldOblique-Foreign]
   9 [/AvantGarde-Book-Foreign /AvantGarde-Demi-Foreign /AvantGarde-BookOblique-Foreign /AvantGarde-DemiOblique-Foreign]
   10 [/Helvetica-Narrow-Foreign /Helvetica-Narrow-Bold-Foreign /Helvetica-Narrow-Oblique-Foreign /Helvetica-Narrow-BoldOblique-Foreign]
   16 [/Bookman-Light-Foreign /Bookman-Demi-Foreign /Bookman-LightItalic-Foreign /Bookman-DemiItalic-Foreign]
   24 [/Times-Roman-Foreign /Times-Bold-Foreign /Times-Italic-Foreign /Times-BoldItalic-Foreign]
   25 [/NewCenturySchlbk-Roman-Foreign /NewCenturySchlbk-Bold-Foreign /NewCenturySchlbk-Italic-Foreign /NewCenturySchlbk-BoldItalic-Foreign]
   26 [/Palatino-Roman-Foreign /Palatino-Bold-Foreign /Palatino-Italic-Foreign /Palatino-BoldItalic-Foreign]
   50 [/ZapfChancery-MediumItalic-Foreign /ZapfChancery-MediumItalic-Foreign /ZapfChancery-MediumItalic-Foreign /ZapfChancery-MediumItalic-Foreign]
   56 [/Symbol /Symbol /Symbol /Symbol] 
   57 [/LineDraw /LineDraw /LineDraw /LineDraw]
   60 [/ZapfDingbats /ZapfDingbats /ZapfDingbats
        /ZapfDingbats]
  ] def
/SLL {/LL def} def
/BD {STh ssc} def
/BU {STh neg ssc} def
/BN {0 ssy neg rmoveto} def
/P {exch msu exch msu neg ptop add moveto} def
/S {currentpoint 3 -1 roll sw 0 32 4 -1 roll widthshow
 smode 1 and 0 ne {false 1.4 ul} if
 smode 2 and 0 ne {true 1.4 ul} if
 smode 4 and 0 ne {false STh ul} if
 smode 8 and 0 ne {ldot} if pop pop} def
/C {1 string dup 0 4 -1 roll put S} def
/J {msu ( ) stringwidth pop sub /sw exch def} def
/PE {showpage ptop exch restore save exch /ptop exch def} def
/SFL {msu /ptop exch def} def
/B {fs 2 and 0 eq {Bft} {BIft} ifelse
 ftsz scalefont setfont fs 1 or /fs exch def} def
/E {Eft ftsz scalefont setfont /fs 0 def} def
/I {fs 1 and 0 eq {Ift} {BIft} ifelse
  ftsz scalefont setfont fs 2 or /fs exch def} def
/BI {BIft ftsz scalefont setfont fs 
 2 or 1 or /fs exch def} def
/LU {1 ssm} def
/LD {2 ssm} def
/LS {4 ssm} def
/LL {/ldmode exch def 8 ssm} def
/LE {not smode and /smode exch def} def

/F {/ftsz exch def (-) stringwidth pop 2 div neg /STh exch def
 /ftcd exch def 
 0 2 fonttable length 1 sub
   {dup fonttable exch get ftcd eq
     {1 add fonttable exch get fontset exit}{pop}ifelse
   }for
 E} def
/fontset {dup 0 get findfont /Eft exch def
          dup 1 get findfont /Bft exch def
          dup 2 get findfont /Ift exch def
          3 get findfont /BIft exch def
         }def
/msu {20 div}def
/ssc {dup /ssy exch def 0 exch rmoveto} def
/ssm {dup smode or /smode exch def} def
/Cf {/Eft /Courier  findfont def /Bft /Courier-Bold findfont def
 /Ift /Courier-Oblique findfont def
 /BIft /Courier-BoldOblique findfont def} def
/ul {gsave /y exch def /dbl exch def 2 copy .2 setlinewidth
 currentpoint dbl {4 copy} if y sub newpath moveto y sub lineto stroke 
 dbl {2.4 sub newpath moveto 2.4 sub lineto stroke} if grestore} def
/PSe {restore end} def
/ldot {gsave 2 copy currentpoint /y exch def /x exch def
 newpath
 ldmode 0 eq {/offset 0 def 1 setlinewidth [1 7] 4 setdash}
 {ldmode 1 eq {[6 2] 6 setdash /offset STh def .2 setlinewidth}
 {ldmode 2 eq {[] 0 setdash /offset 1.4 def .2 setlinewidth} if}
 ifelse} ifelse
 offset sub moveto x y offset sub lineto stroke grestore} def
/reencsmalldict 36 dict def
/ReEncodeSmall
  {reencsmalldict begin
   /newcodesandnames exch def
   /newfontname exch def
   /basefontname exch def
   /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
   newcodesandnames aload pop
   newcodesandnames length 2 idiv
   {newfont /Encoding get 3 1 roll put}
   repeat
   newfontname newfont definefont pop
   end 
  } def
/foreignvec [
128 /Ccedilla
129 /udieresis
130 /eacute
131 /acircumflex
132 /adieresis
133 /agrave
134 /aring
135 /ccedilla
136 /ecircumflex
137 /edieresis
138 /egrave
139 /idieresis
140 /icircumflex
141 /igrave
142 /Adieresis
143 /Aring
144 /Eacute
145 /ae
146 /AE
147 /ocircumflex
148 /odieresis
149 /ograve
150 /ucircumflex
151 /ugrave
152 /ydieresis
153 /Odieresis
154 /Udieresis
155 /cent
156 /sterling
157 /yen
159 /florin
160 /aacute
161 /iacute
162 /oacute
163 /uacute
164 /ntilde
165 /Ntilde
166 /ordfeminine
167 /ordmasculine
168 /questiondown
173 /exclamdown
174 /guillemotleft
175 /guillemotright
225 /germandbls
249 /bullet
] def
/Courier /Courier-Foreign foreignvec ReEncodeSmall
/Courier-Bold /Courier-Bold-Foreign foreignvec ReEncodeSmall
/Courier-Oblique /Courier-Oblique-Foreign foreignvec ReEncodeSmall
/Courier-BoldOblique /Courier-BoldOblique-Foreign foreignvec ReEncodeSmall
/Helvetica /Helvetica-Foreign foreignvec ReEncodeSmall
/Helvetica-Bold /Helvetica-Bold-Foreign foreignvec ReEncodeSmall
/Helvetica-Oblique /Helvetica-Oblique-Foreign foreignvec ReEncodeSmall
/Helvetica-BoldOblique /Helvetica-BoldOblique-Foreign foreignvec ReEncodeSmall
/AvantGarde-Book /AvantGarde-Book-Foreign foreignvec ReEncodeSmall
/AvantGarde-Demi /AvantGarde-Demi-Foreign foreignvec ReEncodeSmall
/AvantGarde-BookOblique /AvantGarde-BookOblique-Foreign foreignvec ReEncodeSmall
/AvantGarde-DemiOblique /AvantGarde-DemiOblique-Foreign foreignvec ReEncodeSmall
/Helvetica-Narrow /Helvetica-Narrow-Foreign foreignvec ReEncodeSmall
/Helvetica-Narrow-Bold /Helvetica-Narrow-Bold-Foreign foreignvec ReEncodeSmall
/Helvetica-Narrow-Oblique /Helvetica-Narrow-Oblique-Foreign foreignvec ReEncodeSmall
/Helvetica-Narrow-BoldOblique /Helvetica-Narrow-BoldOblique-Foreign foreignvec ReEncodeSmall
/Bookman-Light /Bookman-Light-Foreign foreignvec ReEncodeSmall
/Bookman-Demi /Bookman-Demi-Foreign foreignvec ReEncodeSmall
/Bookman-LightItalic /Bookman-LightItalic-Foreign foreignvec ReEncodeSmall
/Bookman-DemiItalic /Bookman-DemiItalic-Foreign foreignvec ReEncodeSmall
/Times-Roman /Times-Roman-Foreign foreignvec ReEncodeSmall
/Times-Bold /Times-Bold-Foreign foreignvec ReEncodeSmall
/Times-Italic /Times-Italic-Foreign foreignvec ReEncodeSmall
/Times-BoldItalic /Times-BoldItalic-Foreign foreignvec ReEncodeSmall
/NewCenturySchlbk-Roman /NewCenturySchlbk-Roman-Foreign foreignvec ReEncodeSmall
/NewCenturySchlbk-Bold /NewCenturySchlbk-Bold-Foreign foreignvec ReEncodeSmall
/NewCenturySchlbk-Italic /NewCenturySchlbk-Italic-Foreign foreignvec ReEncodeSmall
/NewCenturySchlbk-BoldItalic /NewCenturySchlbk-BoldItalic-Foreign foreignvec ReEncodeSmall
/Palatino-Roman /Palatino-Roman-Foreign foreignvec ReEncodeSmall
/Palatino-Bold /Palatino-Bold-Foreign foreignvec ReEncodeSmall
/Palatino-Italic /Palatino-Italic-Foreign foreignvec ReEncodeSmall
/Palatino-BoldItalic /Palatino-BoldItalic-Foreign foreignvec ReEncodeSmall
/ZapfChancery-MediumItalic /ZapfChancery-MediumItalic-Foreign foreignvec ReEncodeSmall
==cut here====================================================================
-- 
Clayton E. Cramer
{pyramid,pixar,tekbspa}!optilink!cramer
Disclaimer?  You must be kidding!  No company would hold opinions like mine!

izumi@violet.berkeley.edu (Izumi Ohzawa) (02/22/89)

In article <976@optilink.UUCP> cramer@optilink.UUCP (Clayton Cramer) writes:
>In article <24469@amdcad.AMD.COM>, phil@diablo.amd.com (Phil Ngai) writes:
>> Word does not seem to put on the .ini file when it prints to a file.
>> Perhaps 4.0 does when printing to a printer but not a file? 
>> Phil Ngai, phil@diablo.amd.com		{uunet,decwrl,ucbvax}!amdcad!phil
>
>You are correct.  The .INI file is not printed to a disk file, only
>the printer.  Some changes to the .INI file are required to make Word
>4.0 print through PC-NFS directly, but it does work.  I use it all
>the time.
>
>Here's the POSTSCRP.INI file I use with PC-NFS:
>==cut here============= ... [PostScript code deleted]....

This brings me to the question of Copyright.
Are we free to distribute POSTRCRP.INI with the actual Word output
to someone else as print file destined for PS printers?
It seems to me that it is a reasonable thing to expect from a
word processing program vendor.

Does Microsoft has any official position on this?
Izumi Ohzawa
izumi@violet.berkeley.edu