[xep-support] Next Installment of CoolTools -- "n-up" processing of pages

Kevin Brown kevin at renderx.com
Mon Dec 21 10:02:15 PST 2009


I had several off line questions so I thought I would post some additional
information here. I guess I should have given a short primer on XEPOUT first
before posting this XSL set.

We all know that RenderX produces output from XSL FO. Most people write XSL
to get to XSL FO from XML, others write XSL FO directly from some
application. RenderX takes in XSL FO and can produce PDF, Postscript, AFP,
XPS, XHTML, and SVG (and some other formats are in the process). We get from
FO to output by producing internal structures of the page output
representation -- the document result tree. This internal representation can
be serialized to disk as an XML structure. This is called the XEP
Intermediate Format or XEPOUT for short.

So ...

XML+XSL -> FO -> XEP Software -> PDF, Postscript, ...

If we "peak under the covers" into "XEP Software" we would see:

XML+XSL -> FO -> XEP Formatter -> XEPOUT -> XEP Generator -> PDF,
Postscript, ...

In fact, one can say that a supported output of XEP Software is XML. The
XEPOUT file is an XML that represents the entire document structure. It
contains a <document> element and also <page> elements and <text> elements
and <image> elements and much more. 

And as I have shown many times, one can even do special tricks. As long as
you do not violate the XEPOUT format, you can manipulate its content and
send it back to XEP. The two parts of this process -- Formatter and
Generator are split in this way. Formatter takes most of the time and
memory, it is performing all the calculations on how to draw the page.
Generator is really a format conversion from the tree representation to the
proper output formats in a serialized fashion for the most part. It is
extremely fast to write the output format to disk -- all the information is
in the XEPOUT file already ... like:

<xep:font family="IDAutomationMICR" weight="400" style="normal"
variant="normal" size="12000"/>
<xep:gray-color gray="0.0"/>
<xep:text value="987654321C" x="60000" y="12681" width="90000"/>
<xep:text value="A123456789A" x="159000" y="12681" width="99000"/>

This says use IDAutomationMICR font in a particular size, weight and
write in black color and
output the string "987654321X" at this exact coordinates and
output the string " A123456789A " at this exact coordinates

So consider the applications here:

XML+XSL -> FO -> XEP Formatter -> XEPOUT -> 
My Custom Transform/Application -> New XEPOUT -> XEP Generator -> PDF,
Postscript, ...

There are many things that can be done. From the very, very simple to the
very complex. You can move things around, stamp new things, slice and dice
up content and pages, etc. You cannot change flowing, line breaking here --
it is already formatted through the Formatter, but you can certainly change
the output.

In the "n-up" case, the custom transform goes through the XEPOUT for any
document and makes a new XEPOUT with say 4 pages for each page. Copying
<page> elements from the input document and pre-pending two supported XEPOUT
elements -- <transform> to move the page locations and <translate> to scale
the page content to the proper size (in the case of 4-up, 1/4th the original
dimension).

There have been many other applications written that leverage this ability.
Concatenation of documents to produce huge collections, implementing
solutions for combining parts of documents together like a textbook that
contain two-column examples as floats on pages that flow in ways unsupported
by XSL FO, measuring the length of classified advertising produced to
transfer to a business solution for billing, implementing custom barcodes
that require the total page number within the document, transforming text to
"any" degree of rotation, ... the list goes on. 

Use your imagination and if you have something that you think cannot be
done, as us.

Kevin Brown
RenderX

-------------------
(*) To unsubscribe, send a message with words 'unsubscribe xep-support'
in the body of the message to majordomo at renderx.com from the address
you are subscribed from.
(*) By using the Service, you expressly agree to these Terms of Service http://www.renderx.com/terms-of-service.html



More information about the Xep-support mailing list