1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287
|
<!doctype html public "-//W3C//DTD HTML 3.2//EN">
<html>
<head>
<title>pstoedit -- Java 2 backend</title>
</head>
<body lang="en">
<h1>Readme for pstoedit -- Java 2 backend</h1>
<p align="center"><strong>17 April 2000</strong><br />
<strong>Wolfgang Glunz/Gisbert W. Selke</strong></p>
<h2>Contents</h2>
<ul>
<li><a href="#intro">Introduction</a></li>
<li><a href="#prep">Preparation</a></li>
<li><a href="#use">Use within HTML documents</a></li>
<li><a href="#viewing">Viewing the results</a></li>
<li><a href="#params">Optional parameters for the applet</a></li>
<li><a href="#bugs">Restrictions, limitations, further development</a></li>
<li><a href="#legal">Legal stuff</a></li>
<li><a href="#authors">Authors</a></li>
</ul>
<a name="intro"></a>
<h2>Introduction</h2>
<p>The file PSDrawing.java contains the Java 2 source code of the
classes needed to run the code generated by the -f java2 option of
pstoedit.</p>
<a name="prep"></a>
<h2>Preparation</h2>
<p>To use the output, do (using Java 2, i.e., at least JDK 1.3):
<pre>
javac PSDrawing.java
</pre>
This needs done once only.</p>
<p><em>Note</em>: You may want to set the DEBUG flag near the beginning
of PSDrawing.java to 0 before compiling.</p>
<a name="use"></a>
<h2>Use within HTML documents</h2>
<h3>Conversion</h3>
<p>First, convert PostScript to Java and compile it (assuming you are
using the JDK):
<pre>
pstoedit -f java2:myclass myfile.ps myclass.java
javac myclass.java
</pre>
Alternatively, if you are using GSView, you can do the conversion via
the menu item <em>Edit</em> -> <em>Convert to vector format...</em>.
You'll still have to compile it either via the JDK compiler or using
your favourite Java programming environment.</p>
<h3>Use within Netscape Navigator</h3>
<p>Then create an HTML document including code like this (this syntax is
for Netscape browsers only):
<pre>
<html>
<head>
<title>PSDrawing generated by pstoedit</title>
</head>
<body>
<p>This is the applet:</p>
<embed type="application/x-java-applet;version=1.2.2"
pluginspage="http://java.sun.com/products/plugin/1.2.2/plugin-install.html"
code="myclass.class"
option1="option_value_for_applet"
width="700" height="500" align="baseline">
<noembed>
This applet needs support for at least Java 1.2.
</noembed>
</embed>
</body>
</html>
</pre></p>
<h3>Use within Internet Explorer</h3>
<p>Unfortunately, the syntax for the Internet Explorer is quite different:
<pre>
<html>
<head>
<title>PSDrawing generated by pstoedit</title>
</head>
<body>
<p>This is the applet:</p>
<object classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93"
width="700" height="500" align="baseline"
codebase="http://java.sun.com/products/plugin/1.2.2/jinstall-1_2_2-win.cab#Version=1,2,2,0">
<param name="code" value="myclass.class">
<param name="type" value="application/x-java-applet;version=1.2.2">
<param name="option1" value="option_value_for_applet">
<param name="scriptable" value="true">
This applet needs support for at least Java 1.2.
</object>
</body>
</html>
</pre></p>
<h3>Use within either Netscape Navigator or Internet Explorer</h3>
<p>And if you want to cope with both, and hopefully others, you have to
go through considerable contortions:
<pre>
<html>
<head>
<title>PSDrawing generated by pstoedit</title>
</head>
<body>
<p>This is the applet:</p>
<object classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93"
width="700" height="500" align="baseline"
codebase="http://java.sun.com/products/plugin/1.2.2/jinstall-1_2_2-win.cab#Version=1,2,2,0">
<param name="code" value="myclass.class">
<param name="type" value="application/x-java-applet;version=1.2.2">
<param name="option1" value="option_value_for_applet">
<param name="scriptable" value="true">
<comment>
<embed type="application/x-java-applet;version=1.2.2"
pluginspage="http://java.sun.com/products/plugin/1.2.2/plugin-install.html"
code="myclass.class"
option1="option_value_for_applet"
width="700" height="500" align="baseline">
<noembed>
</comment>
This applet needs support for at least Java 1.2.
</noembed>
</embed>
</object>
</body>
</html>
</pre></p>
<p><em>(Indeed, this is, strictly speaking, malformed syntax. So
there.)</em></p>
<h3>Use within other browsers</h3>
<p>If you want still other browsers to at least fail gracefully if they
can cope with neither form, you'll have to go to even greater lengths
involving JavaScript. Please refer to the documentation for Sun's HTML
converter available at
<a href="http://java.sun.com/products/plugin">http://java.sun.com/products/plugin</a>
which the above examples have been adapted from.</p>
<a name="viewing"></a>
<h2>Viewing the results</h2>
<p>Then launch a web browser for which a Java 2 plugin exists. If the
plugin is not installed, the above code will get it from Sun's site
(given that an Internet connection is accessible). Note that currently
(early 2000), for most browsers, built-in support for Java 2 is not
sufficient, so a simple <applet> tag will not do any longer. If
you want to be free from this restriction, use the <code>-f java</code>
option, which produces Java 1 code, but which has some other
limitations.</p>
<p>The applet supports panning by pressing the primary mouse key and
dragging.</p>
<p>For testing purposes, using the appletviewer (which comes with the
JDK) may be faster than employing a full-fledged browser.</p>
<a name="params"></a>
<h2>Optional parameters for the applet</h2>
<p>Currently there are 4 optional parameters for the applet.</p>
<ul>
<li>The first is called <code>zoom</code>. If it is present in the HTML
code for the specification of the applet, the user will be presented
with <em>zoom in</em> and <em>zoom out</em> buttons. If it starts with a
valid positive number, this will be the initial zoom factor at which
the applet is displayed. The default value is 1. If it contains another
valid number greater than 1, separated by a blank, this will be the
zoom step which is applied whenever the zoom-in button is pressed. The
default is 1.2.</li>
<li>The next parameter is <code>rotate</code>. If it is present in the
HTML code for the specification of the applet, the user will be
presented with a <em>rotate</em> button. If it starts with a valid
number, this will be the initial rotation (measured counter-clockwise
in degrees) at which the applet is displayed. The default value is 0.
If it contains another valid number, separated by a blank, this will be
the increment in the angle whenever the <em>rotate</em> button is
pressed. The default is 90. -- This whole feature is mainly useful for
viewing graphics in landscape or skyscape orientation rather than
portrait. Note that there is no <em>rotate clockwise</em> button.</li>
<li>The third parameter is <code>offset</code>. Two valid numbers may be
supplied (default: 0 0) which specify an initial
<code>x</code>/<code>y</code> shift for the display.</li>
<li>Finally, for multi-page data, the starting page to be displayed can
be specified using the parameter <code>page</code>, numbered from 1.
Usually, the first page is chosen. Note that the user is offered
<em>previous</em>/<em>next</em> buttons automatically whenever more
than one page is present. Neither does this depend on the presence of
the <code>page</code> parameter, nor can it be switched off via a
parameter.</li>
</ul>
<h3>Examples:</h3>
<ul>
<li>Netscape Navigator:
<pre>
zoom="yes" or zoom="0.5 1.4" within the <embed ...> tag
rotate="-90 45"
offset="-100 200"
page="3"
</pre></li>
<li>Internet Explorer:
<pre>
<param name="zoom" value="yes"> or
<param name="zoom" value="0.5 1.4">
<param name="rotate" value="-90 45">
<param name="offset" value="-100 200">
<param name="page" value="3">
</pre></li>
</ul>
<a name="bugs"></a>
<h2>Restrictions, limitations, further development</h2>
<p>The classes provide limited functionality at the moment. It is work
in progress. Topics that need to be addressed include:</p>
<ul>
<li>bitmap images are currently displayed in grayscale only; in any
case, support is still very sketchy. Do not rely on this to
work yet.</li>
<li>not all types of bitmaps (e.g., CMYK colour model) are supported</li>
<li>add printing</li>
<li>add applet parameter for background colour?</li>
<li>add support for use as stand-alone application (rather than applet)</li>
<li>add proper javadoc comments to PSDrawing.java</li>
</ul>
<p>Since the whole thing is pretty much alpha, I'd appreciate bug
reports and suggestions on the Java 2 backend. Mail to <a
href="mailto:gisbert@tapirsoft.de">Gisbert</a>.
(Please, do not ask for extensions of the Java 1.x backend. That
one is as good as it gets. Please, do not ask me (Gisbert) about
functionality of pstoedit in general. I don't even know how it works its
magic.)</p>
<a name="legal"></a>
<h2>Legal stuff</h2>
<p>Finally, the source code is covered by the GPL the same way as
pstoedit. It is copyright © 1998-2000 Wolfgang Glunz and Gisbert W.
Selke. This does not include the code generated by pstoedit! That
code is free without any restrictions. See the file Copying in the main
directory of the pstoedit distribution for the details of the GPL.</p>
<p>The icons for zoom-in and zoom-out have been nicked from the
fine product
<a href="http://www.cs.wisc.edu/~ghost/">GSView</a> by Russell
Lang/Ghostgum.</p>
<a name="authors"></a>
<h2>Authors</h2>
<p>pstoedit was created and is maintained by
<a href="mailto:wglunz@geocities.com">Wolfgang Glunz</a>.<br />
Java support was created by Wolfgang, too. It is currently under
development by <a href="mailto:gisbert@tapirsoft.de">Gisbert W.
Selke</a> of <a href="http://www.tapirsoft.de">TapirSoft Gisbert
& Harald Selke GbR</a>.</p>
</body>
</html>
|