[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: PostScript to Ascii
From: |
Cameron Simpson |
Subject: |
Re: PostScript to Ascii |
Date: |
Fri, 3 Sep 93 10:38:06 +1000 |
address@hidden (Jeff Kingston) writes:
| There have been some questions about getting Lout to produce
| Ascii output, to which my response has been that a PostScript
| to Ascii filter would be good if there was such a thing.
A specially hacked PostScripter interpret could possibly do a passable job.
Whenever I want PS->text I usually just want the text and am prepared to lose
a lot of the pretty printing. I have a script called unps being:
#!/bin/sh
#
# Like strings(1) for PostScript.
# - Cameron Simpson, 21nov92
#
sed -e '/([^()]*)/!d
s/[^()]*(//
s/)[^()]*(/\
/g
s/)[^()]*$//
s/\\\([()]\)/\1/g
/^$/d' ${1+"$@"} | fmt
This produces a surprisingly readable version of most PostScript documents.
Jeff cites address@hidden (Nils-Peter Nelson):
| Wolfgang Denk wins the prize. The way to convert troff to
| ASCII is to use troff. The DWB 3.3/3.4 versions of troff
| include nroff in the same executable, to assure compatible
| behavior.
Yeh, this has long bothered me about Lout; there's no nroff-like version.
I expect it'd be none too easy.
| *All other strategies will fail* (awk, sed, perl,
| etc.) Best they can do is handle obvious things like .sp
| or .P. Only a real [n|t]roff can expand macros, evaluate
| registers, handle conditionals, etc.
Well, you could get at the ditroff output (before the psdit phase) with Perl
etc where there's still a lot of semantic information.
| In DWB 3.4 we have a PostScript-to-ASCII conversion program,
| which works fine on text but doesn't do a lot for pictures.
Likewise the above script.
- Cameron Simpson
address@hidden, DoD#743
--
SCCS, the source motel! Programs check in and never check out! - Ken Thompson
- Re: PostScript to Ascii,
Cameron Simpson <=