xmlgraphics-general mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jeremias Maerki <...@jeremias-maerki.ch>
Subject [VOTE] New component: DSC parser/processor
Date Sat, 03 Feb 2007 18:18:21 GMT
Hi there

I've just finished the initial version of a DSC parser which I'd like to
put into XML Graphics Commons. What the heck is a DSC parser? :-) Here's
the text of the (somewhat minimal) documentation I wrote for the thing:


DSC parser/processor

Many PostScript files use special comments to structure a document. This
allows manipulation of PostScript files without interpreting them. These
special comments are defined in the Document Structuring Conventions.
The code in Commons is designed to work with DSC 3.0. For details on how
DSC is used, please take a look at the DSC specification.

The DSC support in Commons was primarily developed to implement resource
optimization features in Apache FOP's PostScript output support.
Resources like images which are used repeatedly in a document should not
be written to the PostScript file each time it is used. Instead it is
written once at the beginning of the file as a PostScript form. The form
is then called whenever the image needs painting.

But the DSC parser could potentially be used for other purposes. The
most obvious is extracting a subset of pages from a DSC-compliant file.
Assume you want to print only page 45 to 57 of a particular document.
There's an example that demonstrates exactly this. Check out the
"examples" directory in the distribution. Other potential use cases for
the DSC parser are:

    * Patching PostScript files, for example, adding OMR marks for automatic packaging
    * Imposition (2-up, n-up, rotation, etc.)
    * EPS graphic extraction
    * Inspecting the page count
    * etc. etc.

The DSC parser (DSCParser) was designed as a pull parser, i.e. you fetch
new events from the parser inspecting them and acting on them as they
are found. If you prefer to work with a push parser, you can pass the
DSCParser a DSCHandler implementation and the parser will send you all
the events.

The best example to understand how to use the DSC parser is the
PageExtractor class that implements the page extraction functionality
mentioned above. 


I hope that explains what I've built. I'd like to ask if anyone has any
reservations about my adding the DSC parser to XML Graphics Commons.
After all, it's a rather large and completely new thing and therefore I
thought it necessary to ask before committing. It's probably a lot less
interesting for Batik, but it is for FOP. Since it is designed to be
used separately from FOP I thought it was best to put it in Commons.
I've also already built the resource optimization functionality for FOP
that uses the DSC parser. I can commit those changes (Commons and FOP)
as soon as we know that nobody objects.

I've made a patch containing the DSC parser available (including full
javadocs, an example and minimal documentation for the website), so you
can see what exactly we're talking about:

+1 from me for adding the DSC parser (obviously).

Jeremias Maerki

Apache XML Graphics Project URL: http://xmlgraphics.apache.org/
To unsubscribe, e-mail: general-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: general-help@xmlgraphics.apache.org

View raw message