Citrix Internship

Matthew Johnson

JICA Universal Printer Driver

This is what I've been doing for the last 11 weeks of my holiday, mostly working on the Universal Printer Driver for the Java ICA Client
ICA Printing
Jica and IE

MetaFrame applications need to be able to print to client-attached printers. However:

This used to be done by installing the printer driver on the MetaFrame server, and sending raw data to the printer on the client. However:
Universal Printer Driver

We want a server driver that will work for all client printers.

Printing in Java

Printing is done by drawing into a Graphics2D object, so I have written a renderer to take PCL, parse it in Java, and then draw the result to a Graphics2D object. This is connected to the printer.

The interface is actually the same no matter what you are rendering the graphics to. This makes it very easy to test the renderer without having to print.

The Graphics2D API provides interfaces for

Rendered page in a Frame
You can see here my code rendering a printed page from IE into a pane of a window in Java. This was the test-harness I used for a lot of my testing
The Driver Architecture
This is how I designed the Printer driver. I tried to keep it fast and simple, but yet also generic enough to handle all the PCL 5 features.
Architecture - Extensible

I designed the UPD to be extensible from PCL 4 to the more advanced PCL 5, so that it could be easily extended in the future.

Architecture - Modularised

The driver is broken into two parts, the parser, and the renderer.

The parser is a standard recursive-descent style parser, which takes the PCL and returns a stream of objects representing all the commands or streams of character codes in the PCL.

These then get passed to the rendering layer, which executes the commands in the order they are passed and performs caching for multiple passes.

Java uses a multi-pass approach to printing, so my renderer gets called multiple times per page. It uses a lot of caching of the command objects, and of the images they produce to speed up multiple passes of each page. This has some amount of memory overhead, but most of the data requires caching over the length of one page anyway for transparency checking. There are several caches in use, but the use of references allows the data to only be stored once, and be referenced multiple times.
Architecture - OO

The code for the renderer is implemented via methods in the stateless stream of objects, and state is held in an environment object, which holds a Hashtable of various values, and is used to hold state for multi-command items (like raster graphics).

There is a hierarchy of data classes which allows up-casting to make the controlling methods very general

UML Class Heirachy
The right hand tree is the important one, where all the classes for the parts of the PCL stream are represented.
The result
Problems 1

PCL Specifications

Problems 2


Working in Citrix

I've thoroughly enjoyed working at Citrix. Some of the things which have highlighted this are:

Things I've Learnt
Just to keep Tosha happy:Farah Fawcett