1 | package prescript
|
---|
2 |
|
---|
3 |
|
---|
4 | #######################################################################
|
---|
5 | # java images/scripts
|
---|
6 | #######################################################################
|
---|
7 |
|
---|
8 | # the _javalinks_ macros are the flashy image links at the top right of
|
---|
9 | # the page.
|
---|
10 |
|
---|
11 | _javalinks_ {_imagehome_}
|
---|
12 | _javalinks_ [v=1] {
|
---|
13 | _imagehome_<br>
|
---|
14 | }
|
---|
15 |
|
---|
16 |
|
---|
17 | #######################################################################
|
---|
18 | # icons
|
---|
19 | #######################################################################
|
---|
20 |
|
---|
21 | _iconhpscrpt_ {<img src="_httpiconhpscrpt_" width=_widthhpscrpt_ height=_heighthpscrpt_}
|
---|
22 |
|
---|
23 | #######################################################################
|
---|
24 | # http macros
|
---|
25 | #
|
---|
26 | # These contain the url without any quotes
|
---|
27 | #######################################################################
|
---|
28 |
|
---|
29 | _httpiconhpscrpt_ {_httpimg_/h\_pscrpt.gif}
|
---|
30 | _widthhpscrpt_ {200}
|
---|
31 | _heighthpscrpt_ {57}
|
---|
32 |
|
---|
33 |
|
---|
34 | #######################################################################
|
---|
35 | # page content
|
---|
36 | #######################################################################
|
---|
37 |
|
---|
38 | _pagetitle_ {NZDL: PreScript}
|
---|
39 |
|
---|
40 | _imagethispage_ {_iconhpscrpt_}
|
---|
41 |
|
---|
42 | _content_ {
|
---|
43 | _iconblankbar_
|
---|
44 | <p>
|
---|
45 | <i>PreScript</i> is a utility for extracting text from PostScfript files.
|
---|
46 | PreScript offers:
|
---|
47 |
|
---|
48 | <dl>
|
---|
49 | <dt><b>PostScript conversion to plain ASCII or HTML.</b></dt>
|
---|
50 |
|
---|
51 | <dd><i>PreScript</i> is really a PostScript to plain text converter,
|
---|
52 | but rudimentary HTML can also be produced. Tags are inserted to mark
|
---|
53 | paragraphs (<p>), short lines (<br>), page breaks
|
---|
54 | (<hr>), and header and footers (italisized with
|
---|
55 | <i>...</i>).
|
---|
56 |
|
---|
57 | <dt><b>Paragraph boundaries detection.</b></dt>
|
---|
58 | <dd><i>PreScript</i> determines the line spacing of a document and
|
---|
59 | uses this (and also indentations) to determine paragraph boundaries.
|
---|
60 |
|
---|
61 | <dt><b>Hyphenation removal.</b></dt>
|
---|
62 | <dd>Hyphenated words are de-hyphenated.
|
---|
63 |
|
---|
64 | <dt><b>Ligature translation.</b></dt>
|
---|
65 | <dd>Most ligatures used by TeX document are detected.
|
---|
66 | <i>PreScript</i> doesn't track font changes making it impossible to
|
---|
67 | reliablely detect all ligatures.
|
---|
68 |
|
---|
69 | </dl>
|
---|
70 | <br>
|
---|
71 | <h3>Installing PreScript</h3>
|
---|
72 | <i>PreScript</i> is written in PostScript and Python. You will
|
---|
73 | need <a href="http://www.cs.wisc.edu/~ghost">Ghostscript</a> (at least
|
---|
74 | version 4.01) and the
|
---|
75 | <a href="http://www.python.org">Python</a> interpreter (at least
|
---|
76 | version 1.4.).
|
---|
77 |
|
---|
78 | <h4>The PreScript 0.1 distribution</h4>
|
---|
79 |
|
---|
80 | This distribution is the most stable - it is what you should use to
|
---|
81 | do real work.
|
---|
82 |
|
---|
83 | <ul>
|
---|
84 |
|
---|
85 | <li>Download the <a href="http://www.nzdl.org/download/prescript/prescript-0.1.tar.gz">PreScript
|
---|
86 | 0.1</a> distribution.
|
---|
87 |
|
---|
88 | <li>Define the environment variable <tt>PRESCRIPT_DIR</tt> to the
|
---|
89 | directory where <i>PreScript</i> is installed (or where ever you put
|
---|
90 | <tt>prescript.ps</tt>).
|
---|
91 |
|
---|
92 | <li>Move <tt>prescript.py</tt> to a directory listed in your
|
---|
93 | <tt>PATH</tt> environment variable. You may want to remove the
|
---|
94 | <tt>.py</tt> suffix (<tt>prescript.py</tt> can be either a standalone
|
---|
95 | program, or an imported library of another Python program).
|
---|
96 |
|
---|
97 | <li>Change <tt>\#! /usr/local/bin/python</tt> in
|
---|
98 | <tt>prescript.py</tt> to the location of your Python interpreter.
|
---|
99 |
|
---|
100 | </ul>
|
---|
101 |
|
---|
102 | <h4>The PreScript 2 distribution</h4>
|
---|
103 |
|
---|
104 | This is a beta release of our latest version. This version is a lot cleaner and
|
---|
105 | faster; it is also extensible (users can write their own renderers),
|
---|
106 | better documented, and contains better prediction of line, paragraph,
|
---|
107 | and page breaks. If you notice any bugs, want to request new
|
---|
108 | features, or want to become a beta tester please email the <a
|
---|
109 | href="mailto:[email protected]">New Zealand Digital Library
|
---|
110 | administrator</a>.
|
---|
111 |
|
---|
112 | <ul>
|
---|
113 |
|
---|
114 | <li>Download a <i>PreScript 2</i> distribution (the later versions are more stable).
|
---|
115 |
|
---|
116 | <blockquote>
|
---|
117 | <a href="http://www.nzdl.org/download/prescript/prescript-2.0.tar.gz">PreScript 2.0</a><br>
|
---|
118 | <a href="http://www.nzdl.org/download/prescript/prescript-2.1.tar.gz">PreScript 2.1</a><br>
|
---|
119 | <a href="http://www.nzdl.org/download/prescript/prescript-2.2.tar.gz">PreScript 2.2</a> -- same as Prescript 2.1 but compatibility issues
|
---|
120 | with python 1.5 have been fixed
|
---|
121 | </blockquote>
|
---|
122 |
|
---|
123 | <li>On unix systems 'make install' will install prescript to /usr/local/bin. It will
|
---|
124 | also install the accompanying manual page (to install somewhere else simply edit
|
---|
125 | the Makefile).
|
---|
126 |
|
---|
127 | <li>If not installing with the make utility:<br>
|
---|
128 | It is easiest if all of the program scripts are kept in the same directory,
|
---|
129 | which ideally should be listed in the <tt>PATH</tt> environment variable. If
|
---|
130 | this is inconvenient, be sure that <tt>PRESCRIPT_DIR</tt> points to where
|
---|
131 | <tt>prescript.ps</tt> is installed, and that <tt>PYTHONPATH</tt> points to
|
---|
132 | where <tt>*.py</tt> are installed.
|
---|
133 |
|
---|
134 | <li>Change <tt>\#!/usr/local/bin/python</tt> in <tt>prescript</tt> to the
|
---|
135 | location of your Python interpreter ('make install' does NOT do this for you).
|
---|
136 |
|
---|
137 | </ul>
|
---|
138 | <br>
|
---|
139 |
|
---|
140 | <h3>Running PreScript</h3>
|
---|
141 | <b>Usage:</b>
|
---|
142 | <blockquote>
|
---|
143 | prescript <i>format</i> <i>input</i> [<i>output</i>]
|
---|
144 | </blockquote>
|
---|
145 |
|
---|
146 | <ul>
|
---|
147 | <li><i>format</i> is either <tt>plain</tt> or <tt>html</tt>.
|
---|
148 | <li><i>input</i> is the input filename, a PostScript file.
|
---|
149 | <li><i>output</i> is the output filename. By default, the output file
|
---|
150 | name is the same as the input filename with the path removed and suffix
|
---|
151 | replace to either <tt>.txt</tt> or <tt>.html</tt>.
|
---|
152 | </ul>
|
---|
153 |
|
---|
154 | <br>
|
---|
155 | <h3>Bugs</h3>
|
---|
156 | Please report bugs to the <a
|
---|
157 | href="mailto:[email protected]">New Zealand Digital Library
|
---|
158 | administrator</a>.
|
---|
159 | <p><br>
|
---|
160 |
|
---|
161 | <h3>Notes</h3>
|
---|
162 | <i>PreScript</i> is a port of a Perl program used by the New Zealand Digital
|
---|
163 | Library project to convert computer science technical reports to HTML. The
|
---|
164 | Perl version is deemed unfit for a public release because the code is quite
|
---|
165 | messy (a consequence of Perl's cumbersome syntax for defining objects). The
|
---|
166 | Python version is considerably easier to understand, maintain, and extend.
|
---|
167 | The technical paper <a
|
---|
168 | href="http://www.nzdl.org/download/prescript/prescript.ps.gz">prescript.ps.gz</a> documents the
|
---|
169 | algorithms and heuristics used in <i>PreScript 0.1</i> - there is an
|
---|
170 | update to this for <i>PreScript 2</i> inside its distribution
|
---|
171 | archive.<p><br>
|
---|
172 |
|
---|
173 | <h3>Other Postscript Converters</h3>
|
---|
174 | Here is a summary of other PostScript to text converters we found.
|
---|
175 |
|
---|
176 | <dl>
|
---|
177 | <dt><a
|
---|
178 | href="http://www.research.digital.com/SRC/virtualpaper/pstotext.html"><b>pstotext</b></a></dt>
|
---|
179 |
|
---|
180 |
|
---|
181 | <dd>From the DEC Virtual Paper research project. PostScript program
|
---|
182 | and C program. Probably the best PostScript to text converter (after
|
---|
183 | <i>PreScript</i>, of course).
|
---|
184 |
|
---|
185 | <dt><a
|
---|
186 | href="http://stasi.bradley.edu/ftp/pub/ps2html/ps2html-v2.html"><b>ps2html,
|
---|
187 | The Sequel</b></a></dt>
|
---|
188 |
|
---|
189 | <dd>Developed at John Hopkins University to convert JHU journal
|
---|
190 | articals to HTML. This converter attempts to preserve the formatting
|
---|
191 | of the original PostScript document, but is tied to PostScript
|
---|
192 | files generated with a specific package (QuarkXPress?). A table
|
---|
193 | describing a number of parameters is used to aid conversion and can be
|
---|
194 | modified for new formats. Uses a variation of Ghostscript's
|
---|
195 | <tt>ps2ascii.ps</tt>.
|
---|
196 |
|
---|
197 | <dt><b>ps2ascii.ps</b></dt>
|
---|
198 |
|
---|
199 | <dd>Part of the Ghostscript distribution. <tt>ps2ascii.ps</tt> is
|
---|
200 | considerably less robust than <i>PreScript</i>.
|
---|
201 |
|
---|
202 | <dt><a
|
---|
203 | href="ftp://ftp.mpce.mq.edu.au/pub/comp/src/ps2a.sh"><b>ps2a.sh</b></a></dt>
|
---|
204 |
|
---|
205 | <dd>A PostScript program similar to Ghostscript's <tt>ps2ascii.ps</tt>.
|
---|
206 |
|
---|
207 | <dt><a href="ftp://apocalypse.engr.ucf.edu:/usr/ssd/ps2ascii.shar"><b>ps2ascii.shar</b></a></dt>
|
---|
208 |
|
---|
209 | <dd>A PostScript program and Perl script.
|
---|
210 |
|
---|
211 | <dt><a
|
---|
212 | href="ftp://wilma.cs.brown.edu/pub/postscript/ps2ascii.pl"><b>ps2ascii.pl</b></a></dt>
|
---|
213 |
|
---|
214 | <dd>A Perl script that extracts parenthesized text from a PostScript
|
---|
215 | file.
|
---|
216 |
|
---|
217 | <dt><a
|
---|
218 | href="ftp://ftp.funet.fi/pub/archive/alt.sources/volume92/Feb/920223.01.gz"><b>ps2txt</b></a></dt>
|
---|
219 |
|
---|
220 | <dd>A stand alone C program that extracts parenthesized text. Some
|
---|
221 | special code to deal with <tt>dvips</tt> generated files.
|
---|
222 |
|
---|
223 | </dl>
|
---|
224 |
|
---|
225 | }
|
---|