Hello,

 

I tried to use FOP 0.20.5 and XDK 10.10.0.2.0 but they donīt work together. If I use an older version of the XDK it works but I have to use the new one.

 

The XDK needs a XSQLFOPSerializer class. The code of this class is at the bottom.

 

I would by happy if someone can help me.

 

 

 

package oracle.xml.xsql.serializers;

 

import org.w3c.dom.Document;

import org.apache.fop.messaging.MessageHandler;

import oracle.xml.xsql.XSQLPageRequest;

import oracle.xml.xsql.XSQLDocumentSerializer;

import org.apache.fop.apps.Driver;

import org.apache.avalon.framework.logger.Logger;

import org.apache.avalon.framework.logger.ConsoleLogger;

 

/**

* Tested with the FOP 0.20.3RC release from 19-Jan-2002

*/

public class XSQLFOPSerializer implements XSQLDocumentSerializer {

private static final String PDFMIME = "application/pdf";

public void serialize(Document doc, XSQLPageRequest env) throws Throwable {

try {

 

// First make sure we can load the driver

Driver FOPDriver = new Driver();

 

// Tell FOP not to spit out any messages by default.

// You can modify this code to create your own FOP Serializer

// that logs the output to one of many different logger targets

// using the Apache LogKit API

Logger logger = new ConsoleLogger(ConsoleLogger.LEVEL_INFO);

MessageHandler.setScreenLogger(logger);

FOPDriver.setLogger(logger);

 

// Some of FOP's messages appear to still use MessageHandler.

MessageHandler.setOutputMethod(MessageHandler.NONE);

 

// Then set the content type before getting the reader/

env.setContentType(PDFMIME);

 

FOPDriver.setOutputStream(env.getOutputStream());

FOPDriver.setRenderer(FOPDriver.RENDER_PDF);

FOPDriver.render(doc);

}

catch (Exception e) {

// Cannot write PDF output for the error anyway.

// So maybe this stack trace will be useful info

e.printStackTrace(System.err);

}

}

}

 

Reply via email to