diff options
Diffstat (limited to 'test/java/org/apache/fop/visual/BitmapProducerJava2D.java')
-rw-r--r-- | test/java/org/apache/fop/visual/BitmapProducerJava2D.java | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/test/java/org/apache/fop/visual/BitmapProducerJava2D.java b/test/java/org/apache/fop/visual/BitmapProducerJava2D.java index 06f3b6b5e..060384447 100644 --- a/test/java/org/apache/fop/visual/BitmapProducerJava2D.java +++ b/test/java/org/apache/fop/visual/BitmapProducerJava2D.java @@ -1,5 +1,5 @@ /* - * Copyright 2005 The Apache Software Foundation. + * Copyright 2005-2006 The Apache Software Foundation. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -34,6 +34,7 @@ import org.apache.avalon.framework.configuration.ConfigurationException; import org.apache.commons.io.IOUtils; import org.apache.fop.apps.FOUserAgent; import org.apache.fop.apps.Fop; +import org.apache.fop.apps.FopFactory; import org.apache.fop.apps.MimeConstants; /** @@ -51,6 +52,9 @@ import org.apache.fop.apps.MimeConstants; */ public class BitmapProducerJava2D extends AbstractBitmapProducer implements Configurable { + // configure fopFactory as desired + private FopFactory fopFactory = FopFactory.newInstance(); + private boolean deleteTempFiles; /** @see org.apache.avalon.framework.configuration.Configurable */ @@ -61,7 +65,7 @@ public class BitmapProducerJava2D extends AbstractBitmapProducer implements Conf /** @see org.apache.fop.visual.BitmapProducer */ public BufferedImage produce(File src, ProducerContext context) { try { - FOUserAgent userAgent = new FOUserAgent(); + FOUserAgent userAgent = fopFactory.newFOUserAgent(); userAgent.setTargetResolution(context.getTargetResolution()); userAgent.setBaseURL(src.getParentFile().toURL().toString()); @@ -69,8 +73,7 @@ public class BitmapProducerJava2D extends AbstractBitmapProducer implements Conf OutputStream out = new FileOutputStream(outputFile); out = new BufferedOutputStream(out); try { - Fop fop = new Fop(MimeConstants.MIME_PNG, userAgent); - fop.setOutputStream(out); + Fop fop = fopFactory.newFop(MimeConstants.MIME_PNG, userAgent, out); SAXResult res = new SAXResult(fop.getDefaultHandler()); Transformer transformer = getTransformer(context); |