Print Module Usage Examples

Whitespace Handling
In this section is explained how the UJAC print module deals with whitespaces in content
containing tags such as <phrase>, <paragraph>, <cells>, <font> etc.
It also describes, how some special characters like tabs, line feeds and spaces are escaped.
 The XML Template  The resulting PDF document.

Fonts
This example shows how to use fonts within UJAC documents.
It shows the usage of build-in fonts as well as the usage of True Type Fonts
The True Type Font 'Vera' is shipped with the Fedora Core 1 Linux distribution.
It is not included here, because I'm not quite sure about copyright issues
regarding these files.
 The XML Template  The resulting PDF document.

Colors
This example shows how to use colors within UJAC documents.
It shows the usage of the register color tag, which allows to define logical
colors for the document.
 The XML Template  The resulting PDF document.

Lists
In this example the output of lists is demonstrated. It shows numbered lists
as well as unnumberd list. It also has an example for a nested list.
 The XML Template  The resulting PDF document.

Sections
This one demonstrates the usage of sections and chapters.
 The XML Template  The resulting PDF document.

Table of Contents
Since release 0.9.9 it's possible to create a table of contents to your document.
This one gets created in a separate step after the main document has been processed.
The TOC and the main document are merged after the TOC has been built. As this feature
requires to generate the main document in memory, the memory consumption is relative
high. To enable it, you have to call a new variant of the method printDocument, which
takes the OutputStream and an additional boolean argument called 'supportToc'. Only if
'supportToc' is given as true the TOC will be generated. In the document itself
there's a new area, reserved for the TOC layout definition. It's called <head>.
All elements, nested in this tag are executed in the TOC creation step. A second new
element which should be mentioned here is the <toc> tag. It iterates over all
TOC entries and allowes a user defined representation of the table of contents.
 The XML Template  The resulting PDF document.

Anchors and Outlines
The following example shows how to use anchors and outlines in UJAC document
templates. It shows how to use outlines relative to the current document position
as well as outlines for explicite document positions.
 The XML Template  The resulting PDF document.

Images
This example shows the output of images. It shows the various options to place images
within the text. It also shows how to place images absolutely on a page and how to put
them into tables. It supports all image formats iText knows plus PDF and SVG documents which
are placed in the document like regular images. Currently the support for PDFs is
limited to documents containing exactly one page.
 The XML Template  The resulting PDF document.

Charts
This example explains, how to output charts within templates. The example
shows the chart gallery from the chart section of this site.
Charts are handled very similar to images, the only difference is that they are not
static imported resources but rendered dynamically.
 The XML Template  The resulting PDF document.

Overlays
This example demonstrates the handling of overlays. It imports an existing PDF page using
the <overlay> tag and puts it to the background, while it draws various, fixed positioned
areas of content in the foreground using the <box> tag.
This technique is ideal, if you have pre defined documents like contracts and you have only
to fill values into some fields. The example overlay does not make very much sense in this
issue, but demponstrates the flexibility of the <box> tag pretty well.
 The XML Template  The resulting PDF document.

Static table output
This example shows how to statically print tables. This means you define both, the
structure and the content within the XML template. This leads into a lot of typing, but
would be the way to use this stuff if you're attempting to generate your XML templates
using XSLT.
 The XML Template  The resulting PDF document.

Static table layout
This example shows how to generate output, using a static table layout but dynamic
content using the <foreach> tag. In this case you have to define a fix layout for the
table within the XML template. You have to know the structure of the table to be
printed and define the width, aligment, etc. for each single cell. If you like to have
more dynamic output and less XML code typing, go ahead to the next example.
 The XML Template  The resulting PDF document.

Fully dynamic table output
This one shows how to dynamically output tables within UJAC documents.
It prints a table, specified in the parameters, passed to the DocumentHandler,
analyzing its structure and taking care of the LayoutHints, which are attached
to its column definitions.
 The XML Template  The resulting PDF document.

Internationalization
This section shows a simple example how internationalization is supported in
UJAC document templates
 The XML Template  The resulting PDF document.

Custom tags
This one shows how to define custom tags and how to use them.
In this cast the custom tags are defined in a separate module and imported,
outside the document template using the loadModule method of the DocumentPrinter.
The module defines the custom tags, macros and other definitions, the document
templates builds the PDF using those definitions.
 The used Module  The XML Template  The resulting PDF document.

Report output
In this example is shown how to dynamically output reports within UJAC documents.
It prints a sample DataTable, decorated through a ReportTable. At the report table
some groups and functions are registerd to demonstrate the currently implemented
features. This example can not be executed using the DocumentPrinter command
line tool. The resulting PDF was created using this sample code.
 The XML Template  The resulting PDF document.

Graphics
This section shows how to output graphical primitives like lines, rectangles, circles,
polygons, etc. using UJAC document templates
 The XML Template  The resulting PDF document.

AcroForms
In this example, the support for AcroForms is demonstrated. AcroForms allow you to
define input forms like HTML forms inside your PDF document.
 The XML Template  The resulting PDF document.

Table Definitions
It's possible now, to define data tables inside your XML document templates. This can be useful for some reporting tasks.
 The XML Template  The resulting PDF document.

Styles
The print module knows styles which makes the formatting of documents easier.
This solution is inspired by CSS known from HTML.
You can define styles using the <style-def> tag. If you like to use this style for a specific element, you have to use the new attribute 'class' which is supported for most tags now.
 The XML Template  The resulting PDF document.