A simple Multi Page Image Viewer Applet. To view multipage *.sff, *.tiff and *.gif files. Twain and SANE test application.

This application was developed to open, show and save multi page *.sff image files and to test the uk.co.mmscomputing.imageio.sff package.
Start with :

java -Xmx128m uk.co.mmscomputing.application.imageviewer.MainApp
When dealing with images you usually need to increase the memory settings for the jvm (java virtual machine). The default maximum heap size tends to be to small for image programs. The -Xmx option above sets the heap size to 128 mega byte.

If TWAIN is available the program will be able to scan images from TWAIN devices.

If SANE is available the program will be able to scan images from SANE devices.

To start the imageviewer application click here:

Multipage Image Viewer Application with Web Start

To start the imageviewer applet click here:

Multipage Imageviewer Applet

You need at least a 1.4 jre;
Linux/Mozilla 1.6 (SuSE 9.1): Works.
Linux/Konqueror 3.2.1 (SuSE 9.1) Does only seem to work if security manager is switched off [2005-09-19].

If you want to serve this applet via a web server:

  1. Figure out your code base on the web server:
    I.e.: If you unpacked and compiled the uk.co.mmscomputing packages in /home/user/public_html/java and Apache maps the url http://host/~user/ to /home/user/public_html/ then the codebase is http://host/~user/java/.
  2. Write your web page:
    Add either the following applet tag:
    <applet
    code="uk.co.mmscomputing.application.imageviewer.MainApp.class"
    codebase="http://host/~user/java"
    width=100%
    height=100%
    >
    </applet>
    
    or this if you use a signed jar file
    <applet
    code="uk.co.mmscomputing.application.imageviewer.MainApp.class"
    archive="uk.co.mmscomputing.application.imageviewer.jar"
    width=100%
    height=100%
    >
    </applet>
    
  3. Make the client jvm trust you:

    Why: The least thing you want to do is to open image files on the local computer, hence you need the proper access rights on the client computer.

    The simplest way of doing this is to tell your users to edit the jvm java.policy file.
    I.e.: Assume default jdk 1.5.0 set-up on win xp client, the file can be found in c:\Program Files\Java\jre1.5.0\lib\security\
    Or: Linux SuSE 9.1 : /usr/lib/SunJava2-1.4.2/jre/lib/security

    Add the following to the java.policy file:

    grant codeBase "http://host/~user/java/*" {
      permission java.security.AllPermission;
    };
    


    Another option is to create a jar file and sign it with a certificate:
    I.e. use self signed openssl certificate cacert.pem and cakey.pem

    1. Create jar file: uk.co.mmscomputing.application.imageviewer.jar
    2. Create self signed openssl certificate.
      openssl req -new -x509 -key cakey.pem -out cacert.pem -days 1095
    3. Export certificate and private key as PKCS12 keystore.
      openssl pkcs12 -export -in cacert.pem -inkey cakey.pem -out cacert.p12
    4. Get alias name of keystore entry [probably 1]
      keytool -list -v -keystore cacert.p12 -storetype PKCS12 -storepass mycertpasswd
    5. Sign jar file:
      jarsigner -keystore cacert.p12 -storetype PKCS12 -storepass mycertpasswd -sigfile mmsc uk.co.mmscomputing.application.imageviewer.jar myalias


    Or the java way:
    1. keytool -genkey -alias <username> -keypass <password> -storepass <password> -validity <days>
    2. keytool -export -alias <username> -file MyKeyFile.cer
    3. jarsigner -sigfile MyKeyFile.cer uk.co.mmscomputing.application.imageviewer.jar <username>


  4. For scanner access:

    The jtwain and jsane packages try to unzip the native libraries into the clients local tmp folder and load them from there.
    If that does not work jtwain.dll or libjsane.so need to be put into a native library directory.
    I.e.: Assume again default jdk 1.5.0 set-up on win xp client, one directory can be found at c:\Program Files\Java\jre1.5.0\bin\
    Or: Linux SuSE 9.1 : /usr/lib/SunJava2-1.4.2/jre/lib/i386

Projects :
  1. uk.co.mmscomputing.device.sane:
    This open source software project connects the world of java with SANE.SANE is an application programming interface standard used to access scanners & digital cameras ... .This project consists of a SANE frontend written in java.
  2. uk.co.mmscomputing.device.scanner:
    Package scanner provides abstract parent classes to the classes in the twain and sane packages.
  3. uk.co.mmscomputing.device.twain:
    This open source software project connects the world of java with TWAIN.TWAIN is an application programming interface standard used to access scanners & digital cameras ... .
  4. uk.co.mmscomputing.imageio.bmp:
    Classes that enable the java imageio system to read and write *.bmp files.
  5. uk.co.mmscomputing.imageio.gif:
    Classes that enable the java imageio system to read and write *.gif files.
  6. uk.co.mmscomputing.imageio.pdf:
    Classes that enable the java imageio system to write images as *.pdf files and read those files.
  7. uk.co.mmscomputing.imageio.sff:
    Classes that enable the java imageio system to read and write *.sff (structured fax format) files.
  8. uk.co.mmscomputing.imageio.tiff:
    Classes that enable the java imageio system to read and write *.tif (Tagged Image File Format ) files.
  9. uk.co.mmscomputing.util:
    A few useful utility classes