[comp.graphics] PostScript -> DVI or anything else

kiron@db9.CS.Concordia.CA (Kiron Bondale) (05/02/89)

	I have a PostScript file, that I would like to convert to DVI (or actually if possible even to ASCII (fonts/pix are not important in this file))...
I have seen DVI to PostScript converters on uunet and pawl.rpi...but is there anything that goes backwards???

thanks in advance

Kiron

 _________________________________________________________________
 Kiron D. Bondale       Concordia University, Mtl., Quebec, Canada
 "Never mourn Black Omne" ___Habitat:kiron@sunkisd.CS.Concordia.CA
 -----------------------------------------------------------------

cliff@ficc.uu.net (cliff click) (05/02/89)

In article <808@sunkisd.CS.Concordia.CA>, kiron@db9.CS.Concordia.CA (Kiron Bondale) writes:
> 
>I have a PostScript file, that I would like to convert to DVI (or actually
>if possible even to ASCII (fonts/pix are not important in this file))...
>I have seen DVI to PostScript converters on uunet and pawl.rpi...but is 
>there anything that goes backwards???
>Kiron

Postscript is a general purpose programming language (ok, that's stretching
it a bit :-).  In general, it's possible to write impossible twisted code 
that will eventually produce character output.  The only sure-fire way is 
to print the page, and read it with a scanner.  

If your Postscript was generated by an application, and the application's
Postscript is not the twisted nightmare I've seen so many applications 
produce (I helped write a Postscript clone, so I've seen the worst), then
it might be possible to edit the prep script (Postscript-ese for the stuff
at the front of the file), to make executing the program just spit out the
text instead.

Of course some applications build their own fonts, and swap the ASCII 
meanings of the various letters around, so this is no guarentee - unless
you print the page in the first place.  TANSTFL.

-- 
Cliff Click, Software Contractor at Large
Business: uunet.uu.net!ficc!cliff, cliff@ficc.uu.net, +1 713 274 5368 (w).
Disclaimer: lost in the vortices of nilspace...       +1 713 568 3460 (h).

paul@moncam.co.uk (Paul Hudson) (05/03/89)

In article <4054@ficc.uu.net>, cliff@ficc.uu.net (cliff click) writes:
> In article <808@sunkisd.CS.Concordia.CA>, kiron@db9.CS.Concordia.CA (Kiron Bondale) writes:
> > 
> >I have a PostScript file, that I would like to convert to DVI (or actually

> Postscript is a general purpose programming language (ok, that's stretching
> it a bit :-).  In general, it's possible to write impossible twisted code 
> that will eventually produce character output.  The only sure-fire way is 
> to print the page, and read it with a scanner.  

This is a bit pessimistic. Sure, one would have to write a PS
interpreter, but that's not too bad (I speak having done just that),
or snaffle a free one (like GhostScript), but if the PS file produces
output that makes sense for DVI (ie characters, mostly) the conversion
wouldn't be impossible. Even arbitary PS->DVI is possible (one could
alwasy use the '.' as a "pixel" and do all the scan-coversion - one
TeX plotting package does this).

On the other hand, I don't know of a program that does it.
-- 
Paul Hudson	 MAIL: Monotype ADG, Science Park, Cambridge, CB4 4FQ, UK.
		PHONE: +44 (223) 420018	  EMAIL: paul@moncam.co.uk,
	;"	  FAX: +44 (223) 420911		 ...!ukc!acorn!moncam!paul
 `"";";"        "/dev/null full: please empty the bit bucket"

cliff@ficc.uu.net (cliff click) (05/05/89)

[ Long fruitless response because I hate Postscript, press 'n' quick! ]
In article <170@marvin.moncam.co.uk>, paul@moncam.co.uk (Paul Hudson) writes:
> In article <4054@ficc.uu.net>, cliff@ficc.uu.net (cliff click) writes:
> > In article <808@sunkisd.CS.Concordia.CA>, kiron@db9.CS.Concordia.CA (Kiron Bondale) writes:
> > >I have a PostScript file, that I would like to convert to DVI (or actually
> > The only sure-fire way is to print the page, and read it with a scanner.  
> This is a bit pessimistic. Sure, one would have to write a PS
> interpreter, but that's not too bad (I speak having done just that),
I, too, have written a PS interpreter for a commercially available laser
printer.  What I found was that 90% of the PS producing applications wrote
code that breaks 90% of the PS clones (5 or 6 PS clones we tested against 
our suite of application-produced PS code).  The *interpreter* is fairly easy.
Getting the font machinery, error handling, and special primitives (clippath,
setscreen, settransfer, reversepath, etc) right is a nightmare.  Note:  the
Redbook lies about the required behavior of several primitives, and is mum
about much of the magic that goes on behind the scenes in the font machinery.

How would you handle programs that remap the fonts?  (It looks like:
"100 100 moveto (a) show" but the page is rotated 90 degrees, and "a" in 
the current font produces "Company Foobar Logo" using a combo of Times-Roman
and Times-Bold, and is actually printing a logo up the left margin.  Further
the BuildChar routines are recursively stacked 2 deep.)

How about programs that roll their own fonts, and not using an ASCII ordering?
At least one I know looks to see if he has downloaded that character in the
font in his BuildChar routine, and if not he sends stuff back to the host
which causes the host to send down a series of moveto/lineto commands to 
draw the missing character.  In this case the page output is some complex
interaction between the PS application and the host driver.  *Bleah*.

We also have a suite of programs that break (lockup and/or cold boot) the 
Apple Laserwriter.  I wonder what would happen if we fed them to 
DisplayPostscript on NeXT or Sun?  %-)

-- 
Cliff Click, Software Contractor at Large
Business: uunet.uu.net!ficc!cliff, cliff@ficc.uu.net, +1 713 274 5368 (w).
Disclaimer: lost in the vortices of nilspace...       +1 713 568 3460 (h).

greid@adobe.com (Glenn Reid) (05/05/89)

In article <4079@ficc.uu.net> cliff@ficc.uu.net (cliff click) writes:

>We also have a suite of programs that break (lockup and/or cold boot) the 
>Apple Laserwriter.  I wonder what would happen if we fed them to 
>DisplayPostscript on NeXT or Sun?  %-)

Go ahead and run them.  I predict that they'll work fine.  You didn't
mention what model LaserWriter you ran these on, but if it is really
the "LaserWriter", or even the Plus, and not one of the II models, then
it isn't surprising.  That original printer was discontinued in 1986,
when the Plus came out, and the Plus is also now a discontinued
product, as of 1987, I think.

Also, the old LaserWriter used to reboot sometimes when it ran out of
memory at an inopportune time.  This was a bug, but it means it was very
easy to write a program on purpose to cause that printer to reboot.  All
you had to do was to over-allocate memory.

Glenn Reid
Adobe Systems