From: Nikolai Grigoriev (grig@renderx.com)
Date: Wed Apr 21 2004 - 23:13:20 PDT
Louis,
> For reason of collations I would like to be able to store
> the result of several transformations (<xep:document
> xmlns:xep="http://www.renderx.com/XEP/xep" ...)
>
> But how do I call the standard FOTarget to generate the PDF
> with this intermediary Source (a SAXSource) ?
FormatterImpl.createGenerator(FOTarget t) method creates
a generator object from a FOTarget. It implements SAX
ContentHandler; you can specify it as a handler to a SAX
parser that you use to read the intermediate source. Here's how
it should look like:
// Create a formatter
java.util.Properties p = new java.util.Properties();
p.put("ROOT", "c:/xep/");
p.put("VALIDATE", "false");
com.renderx.xep.FormatterImpl formatter =
new com.renderx.xep.FormatterImpl( p);
// Make an output destination, and turn it into a generator
java.io.FileOutputStream fos =
new java.io.FileOutputStream( "c:/tmp/result.pdf");
com.renderx.xep.FOTarget target =
new com.renderx.xep.FOTarget( fos, "pdf");
org.xml.sax.ContentHandler generator =
formatter.createGenerator (target);
// Create an XMLReader, and set the generator as content handler
org.xml.sax.XMLReader reader =
org.xml.sax.helpers.XMLReaderFactory.createXMLReader();
reader.setContentHandler (generator);
// Read the input source in a normal SAX way
org.xml.sax.InputSource source =
new org.xml.sax.InputSource(new java.io.File("c:/tmp/input.xep").toURL());
reader.parse(source);
// That's all
fos.close();
Regards,
Nikolai Grigoriev
RenderX
-------------------
(*) To unsubscribe, send a message with words 'unsubscribe xep-support'
in the body of the message to majordomo@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/tos.html
This archive was generated by hypermail 2.1.5 : Wed Apr 21 2004 - 23:24:47 PDT