Log in

View Full Version : Read DjVu files on the Pocket PC


Menneisyys
10-16-2005, 12:38 PM
DjVu files are document distribution-targeted files like PostScript, Zinio (http://www.zinio.com/), CHM (http://winmobiletech.com/chm/) or PDF. They aren't at all as widespread as the above-mentioned files. However, I've still been asked to scrutinize the possibilities of reading DjVu files on the PPC, particularly because I'm a Java professional and one of the libraries are written in Java. Here're the results.

1. The Lizardtech ExpressView Pocket Internet Explorer plug-in

The (currently) only native PPC client, ExpressView Browser Plugin 3.0 (http://www.lizardtech.com/download/dl_download.php?detail=geo_expressviewppc&platform=pockpc), crashes PIE on both WM2003 and WM2003SE: PIE just exits. It only works on old PPC2k2 devices:

click the link for the screenshot (http://winmobiletech.com/102005DjVu/expressviewppc2k2.gif.png)

I've done quite much work to fix this problem and finding out why it crashes; in vain.

2. The Java DjVu Viewer (http://sourceforge.net/projects/javadjvu/)

As this freely downloadable app has both an applet and an application version, I separately discuss them.

2.1 The application version

It consists of two JAR files, javadjvu.jar and djvuframe.jar . The applet is started by com.lizardtech.djview.Applet in javadjvu.jar , which, then, transfers the execution to a top-level Frame in djvuframe.jar . If the latter JAR file is missing from the CLASSPATH, a The package has been built without application support. error message is displayed. (Emphasizing this will be important upon discussing the IBM J9 JVM!)

It's worth pointing out that the application version on the desktop (tested with J2SE 1.5.0_04-b05) likes to result in java.lang.OutOfMemoryError: Java heap space errors (and the unability to scroll around pages); a quick fix to this is just passing the -Xmx100000000 parameter (which tells the JVM to use a heap size of maximum 100 Mbytes). If you do this, it'll work flawlessly on the desktop.

The Windows batch file I used to invoke the JVM and pass in the necessary parameters (except for the filename – see the parameter %1 –, which must be passed to the batch file by hand) was

set CLASSPATH=djvuframe.jar;javadjvu.jar;
java -Xmx100000000 com.lizardtech.djview.Applet %1


On the Pocket PC, I've tested the standalone application version with all the available JVM's (please see this thread (http://pocketpcmag.com/forum/topic.asp?TOPIC_ID=16612) on them). The results are the following:

2.1.1 CrEme 4.0: it runs, BUT:

1. On QVGA, it's useless because at least half of the buttons aren't even accessible (and there's no scrolling):

click the link for the screenshot (http://winmobiletech.com/102005DjVu/CremE400JavaDjVuQVGA.gif.png)

On VGA, it's better, but there're still no scrollbars – that is, in any non-toy documents (for example, in the The Encyclopedia Britannica, Eleventh Edition Book (http://javadjvu.foxtrottechnologies.com/cgi-bin/djvuapplet.pl/examples/encyclopediabrit26ed11arch.djvu?zoom=width&zoomfast=yes)), it'll be impossible to scroll. That is, almost useless.

click the link for the screenshot (http://winmobiletech.com/102005DjVu/CremE400JavaDjVuVGA.gif.png)

2, It has very big CPU usage after some page switches (this is why I've enabled XCPUScalar on the second screenshot) – will totally slow down the PPC (with all the side effects – enormous battery consumption, heat dissipation etc). (Incidentally, the same effect is present with the applet version, with NetFront 3.2: with it, it'll become impossible to even turn pages after a while!)

The .lnk file I used to invoke the JVM and pass in the necessary parameters was

255#"\Windows\CrEme\bin\CrEme.exe" -Ob -classpath \javadjvu.jar;\djvuframe.jar com.lizardtech.djview.Applet \planes.djvu

where \planes.djvu was the test document I tried to read. (You can freely change this). Also, as can be seen, I've put both JAR files in the root file system of the PDA.

2.1.2 Jeode 1.9.3: useless – displays the top-level frame but nothing happens.

The .lnk file I used to invoke the JVM and pass in the necessary parameters was

255#"\CF Card\Insignia Solutions JeodeRuntime\evm.exe" -Djeode.evm.console.local.keep=true -cp \javadjvu.jar;\djvuframe.jar com.lizardtech.djview.Applet \planes.djvu

2.1.3 IBM J9, Personal Java edition: it says The package has been built without application support. as if it didn't find djvuframe.jar in the classpath. Useless.

The .lnk file I used to invoke the JVM and pass in the necessary parameters was

255#"\Program Files\J9\PPRO10\bin\J9.exe" "-jcl:ppro10" –cp \javadjvu.jar;\djvuframe.jar com.lizardtech.djview.Applet \planes.djvu

2.1.4 Mysaifu 0.1.5 (http://www2s.biglobe.ne.jp/~dat/java/project/jvm/index_en.html) : useless: the user is presented with the, with Mysaifu, very common "Native exception" dialog. Nothing works.

The .lnk file I used to invoke the JVM and pass in the necessary parameters was

255#"\Program Files\Mysaifu JVM\jre\bin\jvm.exe" com.lizardtech.djview.Applet \planes.djvu

(Incidentally, Java freaks: note the lack of any classpath settings in here. From this Mysaifu version, you can put any jar files to \Program Files\Mysaifu JVM\jre\lib\ext, which (\jre\lib\ext) is old hat for any Java programmer. The automatic insertion of JAR files in this directory is a welcome addition compared to previous version, where it wasn't and, therefore, you needed to pass the directory containing the JAR files in the java.ext.dirs system property.)

2.2 The applet version

2.2.1 PIE + CrEme 4.0

No-go – class not found error:

click the link for the screenshot (http://winmobiletech.com/102005DjVu/Creme40Applet.gif.png)

2.2.2 PIE + Jeode 1.9.3

No-go either:

click the link for the screenshot (http://winmobiletech.com/102005DjVu/Jeode193Applet.gif.png)

2.2.3 NetFront 3.2

To a certain degree, it works; however, the CPU usage bug explained above makes it entirely useless after some page turns.

click the link for the screenshot (http://winmobiletech.com/102005DjVu/javadjvu-1.gif.png)

2.2.4 Thunderhawk 2.10

This is the only case the applet version really works.

click the link for the screenshot (http://winmobiletech.com/102005DjVu/DjVuTH.gif.png)

The scrollbars can't be seen on the sceenshot, but they are still present – that is, you can scroll (albeit VERY slowly because of the client/server Java solution where the images to be rendered are sent back by the server.) (With other test documents, the scrollbars were visible too.)

2.3 How do I use the applet version from inside Thunderhawk to access my own books?

The JavaDjVu - Examples page (http://javadjvu.foxtrottechnologies.com/examples/) only contain some pre-defined DjVu documents. If you want to access your own ones, you'll need to upload the following files to anywhere on the Web (for example, a secret directory on your homepage). Make sure you put the necessary files in the same directory – otherwise, you'll need to use the codebase attribute as well (if you put the Java files in a subdirectory of the HTML file).

1. javadjvu.jar
2. DjVuApplet.class
3. a HTML file with an APPLET tag that has the following contents:


<applet
code="DjVuApplet.class"
archive="javadjvu.jar"
width="640"
height="480">
<param name="data" value="planes.djvu">
</applet>


4. the DjVu file you'd like to read in Thunderhawk (see the data parameter here; its value is "planes.djvu" in this example.)

Note that you will need to define a HTML file for each DjVu file you'd like to read because you should only have only one APPLET tag in a HTML file. Just changing the above-explained data parameter (and, preferably, naming your HTML file according to the DjVu file it refers to) will do.

Network hackers & pros note: you can't directly add your own server/document address to the URL http://javadjvu.foxtrottechnologies.com/cgi-bin/djvuapplet.pl/ (I've tested – the example version is only able to read and deliver local files and will throw a java.io.IOException: Invalid DjVu File Format if you try to pass a remote DjVu file address to it). However, as the applet files don't take up much disk space and, being executed strictly on the client-side, don't require anything from the HTTP server (except for that you are allowed to keep them on the server – it's possible some freeweb-space providers don'tr even allow their users to store applets and JAR files on the server), this is by no means a serious restriction.

Note that as Thunderhawk can't access the files in the local file system (unlike "real" browsers), you can't just copy the necessary files in there and just pass it, say, file://\mybook.html (assuming you copy everything needed). It'd indeed make work much faster, but as TH is strictly using the client-server model (because it's the server that makes the real formatting and Java code execution), it can't access anything from local.

3. Bottom line

Unfortunately, except for the QVGA-only, non-local Thunderhawk, it's, currently, impossible to view DjVu files on the Pocket PC.

That is, you will need to wait for the SmartDjVu (http://www.inscenic.com/projects/smartdjvu/) people to come up with something usable.

4. Recommended reading

Pocket PC Web browsers - the complete roundup (http://www.pocketpcthoughts.com/index.php?action=expand,42026) (it also links other, Java compatibility-related threads)

Sergei
11-23-2005, 05:26 AM
Hello!

SmartDjVu is a solution for maximum comfortable viewing and reading books and articles in DjVu format with regard to specificity of reading from the PDA: a small screen, limited controlling (you often have to have the device in one of your hands and control the process with the other one, the limited resources for the processor and memory throughput).

Features:

Wordwrap: the information on the screen is placed in such a way that the horizontal scrolling isn’t enabled and in continual reading it would be possible to use only one button when turning to the next screen.

Pictures displaying: pictures are displayed at the same expansion as the text. The horizontal scrollbar may pop up only while images displaying. If the text has pictures that don’t fit the screen and are lager than it, it doesn’t affect displaying the text divided with words.

Quick screen drawing: the user needn’t wait till the next screen corresponding some part of the page gets drawn.

The pages randomizing: now the user doesn’t need to wait until the image on the screen gets distinct: SmartDjVu loads only a part of the djvu-document into memory, which allows saving memory and greatly speeding up the initial loading of the document. At this time randomizing of some previous pages takes its place that allows finding the compromise between speed of the new page loading up and required memory resources.

The user’s actions predicting: loading up the new pages the user is supposed to skip to. It’s fulfilled at the moments when the user does not need the updating of information on the screen.

Ample opportunities on setting controls up: random setting of functionality for each of the buttons (skipping to the previous or the next screen, pages turning, moving to the up or down from the line, horizontal scrolling, etc.).

You can download the demo version here - http://www.inscenic.com/files/SDVDemoSetup.exe

You can purchase the utility at the Clickapps online store - http://www.clickapps.com/moreinfo.htm?pid=3803

The full information about the SmartDjVu you can read at the product page - http://www.inscenic.com/projects/smartdjvu

http://www.inscenic.com/images/smartdjvu/demo_smartdjvu_page2.gif