SilverStray
Programmer
Hi,
I have a problem with image rendering using FOP transformer. The source file is an XML, and the XSL-FOP is used along with this inorder to generate a PDF file. I run the FOP transformer through servlet. The PDF file displays the GIF image indicated in the XML. But the problem is, even if the GIF file is deleted, or changed, the PDF still displays the old GIF. I tried to use resetCache for FOP, but doesn't seem to work.
Here's a portion of my code where I put the cache statement for FOP. Here I tried to reset the cache before transforming:
//Setup FOP
Driver driver = new Driver();
driver.setLogger(logger);
MessageHandler.setScreenLogger(logger);
org.apache.fop.image.FopImageFactory.resetCache();
driver.setRenderer(Driver.RENDER_PDF);
//Setup a buffer to obtain the content length
//ByteArrayOutputStream out2 = new ByteArrayOutputStream();
OutputStream out = new java.io.FileOutputStream(pdf);
driver.setOutputStream(out);
//Setup Transformer
TransformerFactory factory=TransformerFactory.newInstance();
Transformer transformer = factory.newTransformer(new StreamSource(xslt));
//Make sure the XSL transformation's result is piped
//through to FOP
Result res = new SAXResult(driver.getContentHandler());
//Setup input
Source src = new StreamSource(new StringReader(xmlString));
//Start the transformation and rendering process
transformer.transform(src,res);
out.close();
I hope there's someone out there who can help!
thanks in advance!
I have a problem with image rendering using FOP transformer. The source file is an XML, and the XSL-FOP is used along with this inorder to generate a PDF file. I run the FOP transformer through servlet. The PDF file displays the GIF image indicated in the XML. But the problem is, even if the GIF file is deleted, or changed, the PDF still displays the old GIF. I tried to use resetCache for FOP, but doesn't seem to work.
Here's a portion of my code where I put the cache statement for FOP. Here I tried to reset the cache before transforming:
//Setup FOP
Driver driver = new Driver();
driver.setLogger(logger);
MessageHandler.setScreenLogger(logger);
org.apache.fop.image.FopImageFactory.resetCache();
driver.setRenderer(Driver.RENDER_PDF);
//Setup a buffer to obtain the content length
//ByteArrayOutputStream out2 = new ByteArrayOutputStream();
OutputStream out = new java.io.FileOutputStream(pdf);
driver.setOutputStream(out);
//Setup Transformer
TransformerFactory factory=TransformerFactory.newInstance();
Transformer transformer = factory.newTransformer(new StreamSource(xslt));
//Make sure the XSL transformation's result is piped
//through to FOP
Result res = new SAXResult(driver.getContentHandler());
//Setup input
Source src = new StreamSource(new StringReader(xmlString));
//Start the transformation and rendering process
transformer.transform(src,res);
out.close();
I hope there's someone out there who can help!
thanks in advance!