Re: [xep-support] Serialize Generator intput and then calling the standard PDF Target

From: Nikolai Grigoriev (
Date: Wed Apr 21 2004 - 23:13:20 PDT

  • Next message: Ondřej ©váb: "Re: [xep-support] hyphenation/runFromCommandLine?"


    > For reason of collations I would like to be able to store
    > the result of several transformations (<xep:document
    > xmlns: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 fos =
        new "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 =
    reader.setContentHandler (generator);

    // Read the input source in a normal SAX way
    org.xml.sax.InputSource source =
       new org.xml.sax.InputSource(new"c:/tmp/input.xep").toURL());

    // That's all

    Nikolai Grigoriev

    (*) To unsubscribe, send a message with words 'unsubscribe xep-support'
    in the body of the message to from the address
    you are subscribed from.
    (*) By using the Service, you expressly agree to these Terms of Service

    This archive was generated by hypermail 2.1.5 : Wed Apr 21 2004 - 23:24:47 PDT