diff options
author | Simon Pepping <spepping@apache.org> | 2006-03-07 20:36:14 +0000 |
---|---|---|
committer | Simon Pepping <spepping@apache.org> | 2006-03-07 20:36:14 +0000 |
commit | 976e91c7adf5ebaf8e209ddfa7d15e1195b3082e (patch) | |
tree | cd42741a32dfc13de1642a61854aa81a75a1ca27 | |
parent | b521d507d862a6ac12c725813d6db4d307935640 (diff) | |
download | xmlgraphics-fop-976e91c7adf5ebaf8e209ddfa7d15e1195b3082e.tar.gz xmlgraphics-fop-976e91c7adf5ebaf8e209ddfa7d15e1195b3082e.zip |
Ensure a consistent Fop object in the constructor
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/branches/Temp_API_Finalization@384002 13f79535-47bb-0310-9956-ffa450edef68
15 files changed, 107 insertions, 61 deletions
diff --git a/examples/embedding/java/embedding/ExampleDOM2PDF.java b/examples/embedding/java/embedding/ExampleDOM2PDF.java index b46912a61..59f2bb543 100644 --- a/examples/embedding/java/embedding/ExampleDOM2PDF.java +++ b/examples/embedding/java/embedding/ExampleDOM2PDF.java @@ -1,5 +1,5 @@ /* - * Copyright 1999-2004 The Apache Software Foundation. + * Copyright 1999-2004, 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. @@ -40,7 +40,9 @@ import org.w3c.dom.Node; import org.w3c.dom.Text; // FOP +import org.apache.fop.apps.FOUserAgent; import org.apache.fop.apps.Fop; +import org.apache.fop.apps.FopFactory; import org.apache.fop.apps.MimeConstants; @@ -50,6 +52,9 @@ import org.apache.fop.apps.MimeConstants; */ public class ExampleDOM2PDF { + // configure fopFactory as desired + private FopFactory fopFactory = FopFactory.newInstance(); + /** xsl-fo namespace URI */ protected static String foNS = "http://www.w3.org/1999/XSL/Format"; @@ -62,15 +67,16 @@ public class ExampleDOM2PDF { */ public void convertDOM2PDF(Document xslfoDoc, File pdf) { try { - // Construct fop with desired output format - Fop fop = new Fop(MimeConstants.MIME_PDF); - + FOUserAgent foUserAgent = fopFactory.newFOUserAgent(); + // configure foUserAgent as desired + // Setup output OutputStream out = new java.io.FileOutputStream(pdf); out = new java.io.BufferedOutputStream(out); try { - fop.setOutputStream(out); + // Construct fop with desired output format and output stream + Fop fop = fopFactory.newFop(MimeConstants.MIME_PDF, foUserAgent, out); // Setup Identity Transformer TransformerFactory factory = TransformerFactory.newInstance(); diff --git a/examples/embedding/java/embedding/ExampleFO2PDF.java b/examples/embedding/java/embedding/ExampleFO2PDF.java index aba3fad79..5b39939f8 100644 --- a/examples/embedding/java/embedding/ExampleFO2PDF.java +++ b/examples/embedding/java/embedding/ExampleFO2PDF.java @@ -1,5 +1,5 @@ /* - * Copyright 1999-2005 The Apache Software Foundation. + * Copyright 1999-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. @@ -62,16 +62,17 @@ public class ExampleFO2PDF { try { FopFactory fopFactory = FopFactory.newInstance(); // configure fopFactory as desired + FOUserAgent foUserAgent = fopFactory.newFOUserAgent(); // configure foUserAgent as desired - // Construct fop with desired output format - Fop fop = fopFactory.newFop(MimeConstants.MIME_PDF, foUserAgent); // Setup output stream. Note: Using BufferedOutputStream // for performance reasons (helpful with FileOutputStreams). out = new FileOutputStream(pdf); out = new BufferedOutputStream(out); - fop.setOutputStream(out); + + // Construct fop with desired output format + Fop fop = fopFactory.newFop(MimeConstants.MIME_PDF, foUserAgent, out); // Setup JAXP using identity transformer TransformerFactory factory = TransformerFactory.newInstance(); diff --git a/examples/embedding/java/embedding/ExampleFO2PDFUsingSAXParser.java b/examples/embedding/java/embedding/ExampleFO2PDFUsingSAXParser.java index 38d1ff6c4..99ddab7fd 100644 --- a/examples/embedding/java/embedding/ExampleFO2PDFUsingSAXParser.java +++ b/examples/embedding/java/embedding/ExampleFO2PDFUsingSAXParser.java @@ -1,5 +1,5 @@ /* - * Copyright 1999-2004 The Apache Software Foundation. + * Copyright 1999-2004,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. @@ -36,8 +36,10 @@ import org.xml.sax.helpers.DefaultHandler; import org.xml.sax.SAXException; // FOP +import org.apache.fop.apps.FOUserAgent; import org.apache.fop.apps.Fop; import org.apache.fop.apps.FOPException; +import org.apache.fop.apps.FopFactory; import org.apache.fop.apps.MimeConstants; /** @@ -46,6 +48,9 @@ import org.apache.fop.apps.MimeConstants; */ public class ExampleFO2PDFUsingSAXParser { + // configure fopFactory as desired + private FopFactory fopFactory = FopFactory.newInstance(); + /** * Converts an FO file to a PDF file using FOP * @param fo the FO file @@ -61,17 +66,18 @@ public class ExampleFO2PDFUsingSAXParser { ParserConfigurationException, FOPException, SAXException, IOException { + FOUserAgent foUserAgent = fopFactory.newFOUserAgent(); + // configure foUserAgent as desired + OutputStream out = null; try { - // Construct fop and setup output format - Fop fop = new Fop(MimeConstants.MIME_PDF); - // Setup output stream. Note: Using BufferedOutputStream // for performance reasons (helpful with FileOutputStreams). out = new FileOutputStream(pdf); out = new BufferedOutputStream(out); - fop.setOutputStream(out); + // Construct fop and setup output format + Fop fop = new Fop(MimeConstants.MIME_PDF, foUserAgent, out); // Setup SAX parser // throws FactoryConfigurationError diff --git a/examples/embedding/java/embedding/ExampleFO2RTF.java b/examples/embedding/java/embedding/ExampleFO2RTF.java index 8c85f8a4f..ce3e87f76 100644 --- a/examples/embedding/java/embedding/ExampleFO2RTF.java +++ b/examples/embedding/java/embedding/ExampleFO2RTF.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,8 +34,10 @@ import javax.xml.transform.stream.StreamSource; import javax.xml.transform.sax.SAXResult; // FOP +import org.apache.fop.apps.FOUserAgent; import org.apache.fop.apps.Fop; import org.apache.fop.apps.FOPException; +import org.apache.fop.apps.FopFactory; import org.apache.fop.apps.MimeConstants; /** @@ -46,6 +48,9 @@ import org.apache.fop.apps.MimeConstants; */ public class ExampleFO2RTF { + // configure fopFactory as desired + private FopFactory fopFactory = FopFactory.newInstance(); + /** * Converts an FO file to a RTF file using FOP * @param fo the FO file @@ -55,18 +60,20 @@ public class ExampleFO2RTF { */ public void convertFO2RTF(File fo, File rtf) throws IOException, FOPException { + FOUserAgent foUserAgent = fopFactory.newFOUserAgent(); + // configure foUserAgent as desired + OutputStream out = null; try { - // Construct fop with desired output format - Fop fop = new Fop(MimeConstants.MIME_RTF); - // Setup output stream. Note: Using BufferedOutputStream // for performance reasons (helpful with FileOutputStreams). out = new FileOutputStream(rtf); out = new BufferedOutputStream(out); - fop.setOutputStream(out); + // Construct fop with desired output format + Fop fop = new Fop(MimeConstants.MIME_RTF, foUserAgent, out); + // Setup JAXP using identity transformer TransformerFactory factory = TransformerFactory.newInstance(); Transformer transformer = factory.newTransformer(); // identity transformer diff --git a/examples/embedding/java/embedding/ExampleObj2PDF.java b/examples/embedding/java/embedding/ExampleObj2PDF.java index 99039642c..22afe7058 100644 --- a/examples/embedding/java/embedding/ExampleObj2PDF.java +++ b/examples/embedding/java/embedding/ExampleObj2PDF.java @@ -1,5 +1,5 @@ /* - * Copyright 1999-2004 The Apache Software Foundation. + * Copyright 1999-2004,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. @@ -33,8 +33,10 @@ import javax.xml.transform.stream.StreamSource; import javax.xml.transform.sax.SAXResult; // FOP +import org.apache.fop.apps.FOUserAgent; import org.apache.fop.apps.Fop; import org.apache.fop.apps.FOPException; +import org.apache.fop.apps.FopFactory; import org.apache.fop.apps.MimeConstants; import embedding.model.ProjectTeam; @@ -45,6 +47,9 @@ import embedding.model.ProjectTeam; */ public class ExampleObj2PDF { + // configure fopFactory as desired + private FopFactory fopFactory = FopFactory.newInstance(); + /** * Converts a ProjectTeam object to a PDF file. * @param team the ProjectTeam object @@ -57,14 +62,15 @@ public class ExampleObj2PDF { public void convertProjectTeam2PDF(ProjectTeam team, File xslt, File pdf) throws IOException, FOPException, TransformerException { - // Construct fop with desired output format - Fop fop = new Fop(MimeConstants.MIME_PDF); + FOUserAgent foUserAgent = fopFactory.newFOUserAgent(); + // configure foUserAgent as desired // Setup output OutputStream out = new java.io.FileOutputStream(pdf); out = new java.io.BufferedOutputStream(out); try { - fop.setOutputStream(out); + // Construct fop with desired output format + Fop fop = new Fop(MimeConstants.MIME_PDF, foUserAgent, out); // Setup XSLT TransformerFactory factory = TransformerFactory.newInstance(); diff --git a/examples/embedding/java/embedding/ExampleXML2PDF.java b/examples/embedding/java/embedding/ExampleXML2PDF.java index c554dacee..01bc869cb 100644 --- a/examples/embedding/java/embedding/ExampleXML2PDF.java +++ b/examples/embedding/java/embedding/ExampleXML2PDF.java @@ -1,5 +1,5 @@ /* - * Copyright 1999-2005 The Apache Software Foundation. + * Copyright 1999-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. @@ -31,7 +31,9 @@ import javax.xml.transform.stream.StreamSource; import javax.xml.transform.sax.SAXResult; //FOP +import org.apache.fop.apps.FOUserAgent; import org.apache.fop.apps.Fop; +import org.apache.fop.apps.FopFactory; import org.apache.fop.apps.MimeConstants; /** @@ -65,15 +67,19 @@ public class ExampleXML2PDF { System.out.println(); System.out.println("Transforming..."); - // Construct fop with desired output format - Fop fop = new Fop(MimeConstants.MIME_PDF); - + // configure fopFactory as desired + FopFactory fopFactory = FopFactory.newInstance(); + + FOUserAgent foUserAgent = fopFactory.newFOUserAgent(); + // configure foUserAgent as desired + // Setup output OutputStream out = new java.io.FileOutputStream(pdffile); out = new java.io.BufferedOutputStream(out); try { - fop.setOutputStream(out); + // Construct fop with desired output format + Fop fop = new Fop(MimeConstants.MIME_PDF, foUserAgent, out); // Setup XSLT TransformerFactory factory = TransformerFactory.newInstance(); diff --git a/examples/embedding/java/embedding/intermediate/ExampleConcat.java b/examples/embedding/java/embedding/intermediate/ExampleConcat.java index 845d3bfbf..59d80b636 100644 --- a/examples/embedding/java/embedding/intermediate/ExampleConcat.java +++ b/examples/embedding/java/embedding/intermediate/ExampleConcat.java @@ -33,6 +33,7 @@ import javax.xml.transform.stream.StreamSource; import org.apache.fop.apps.FOPException; import org.apache.fop.apps.FOUserAgent; import org.apache.fop.apps.Fop; +import org.apache.fop.apps.FopFactory; import org.apache.fop.apps.MimeConstants; import org.apache.fop.area.AreaTreeModel; import org.apache.fop.area.AreaTreeParser; @@ -53,6 +54,9 @@ import embedding.model.ProjectTeam; */ public class ExampleConcat { + // configure fopFactory as desired + private FopFactory fopFactory = FopFactory.newInstance(); + /** * Creates a sample ProjectTeam instance for this demo. * @return ProjectTeam the newly created ProjectTeam instance @@ -80,7 +84,7 @@ public class ExampleConcat { throws IOException, FOPException, TransformerException { //Create a user agent - FOUserAgent userAgent = new FOUserAgent(); + FOUserAgent userAgent = fopFactory.newFOUserAgent(); //Create an instance of the target renderer so the XMLRenderer can use its font setup Renderer targetRenderer = userAgent.getRendererFactory().createRenderer( @@ -96,14 +100,12 @@ public class ExampleConcat { //Make sure the prepared XMLRenderer is used userAgent.setRendererOverride(xmlRenderer); - // Construct fop (the MIME type here is unimportant due to the override on the user agent) - Fop fop = new Fop(MimeConstants.MIME_FOP_AREA_TREE, userAgent); - // Setup output OutputStream out = new java.io.FileOutputStream(intermediate); out = new java.io.BufferedOutputStream(out); try { - fop.setOutputStream(out); + // Construct fop (the MIME type here is unimportant due to the override on the user agent) + Fop fop = new Fop(MimeConstants.MIME_FOP_AREA_TREE, userAgent, out); // Setup XSLT TransformerFactory factory = TransformerFactory.newInstance(); diff --git a/src/java/org/apache/fop/apps/Fop.java b/src/java/org/apache/fop/apps/Fop.java index f4e4c048e..37ee50e08 100644 --- a/src/java/org/apache/fop/apps/Fop.java +++ b/src/java/org/apache/fop/apps/Fop.java @@ -120,6 +120,7 @@ public class Fop { * Set the OutputStream to use to output the result of the Render * (if applicable) * @param stream the stream to output the result of rendering to + * @deprecated Set the output stream in the constructor */ public void setOutputStream(OutputStream stream) { this.stream = stream; diff --git a/src/java/org/apache/fop/servlet/FopServlet.java b/src/java/org/apache/fop/servlet/FopServlet.java index a5d8612d7..7aee6bcb3 100644 --- a/src/java/org/apache/fop/servlet/FopServlet.java +++ b/src/java/org/apache/fop/servlet/FopServlet.java @@ -1,5 +1,5 @@ /* - * Copyright 1999-2005 The Apache Software Foundation. + * Copyright 1999-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. @@ -37,8 +37,10 @@ import org.apache.commons.io.output.ByteArrayOutputStream; import org.apache.commons.logging.impl.SimpleLog; //FOP +import org.apache.fop.apps.FOUserAgent; import org.apache.fop.apps.Fop; import org.apache.fop.apps.FOPException; +import org.apache.fop.apps.FopFactory; import org.apache.fop.apps.MimeConstants; /** @@ -200,12 +202,17 @@ public class FopServlet extends HttpServlet { protected byte[] render(Source src, Transformer transformer) throws FOPException, TransformerException { - //Setup FOP - Fop fop = new Fop(MimeConstants.MIME_PDF); + // configure fopFactory as desired + FopFactory fopFactory = FopFactory.newInstance(); + + FOUserAgent foUserAgent = fopFactory.newFOUserAgent(); + // configure foUserAgent as desired //Setup output ByteArrayOutputStream out = new ByteArrayOutputStream(); - fop.setOutputStream(out); + + //Setup FOP + Fop fop = fopFactory.newFop(MimeConstants.MIME_PDF, foUserAgent, out); //Make sure the XSL transformation's result is piped through to FOP Result res = new SAXResult(fop.getDefaultHandler()); diff --git a/test/java/org/apache/fop/BasicDriverTestCase.java b/test/java/org/apache/fop/BasicDriverTestCase.java index c74ecaad9..9f294b412 100644 --- a/test/java/org/apache/fop/BasicDriverTestCase.java +++ b/test/java/org/apache/fop/BasicDriverTestCase.java @@ -1,5 +1,5 @@ /* - * Copyright 1999-2005 The Apache Software Foundation. + * Copyright 1999-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. @@ -28,7 +28,9 @@ import javax.xml.transform.sax.SAXResult; import javax.xml.transform.stream.StreamSource; import org.apache.commons.io.output.ByteArrayOutputStream; +import org.apache.fop.apps.FOUserAgent; import org.apache.fop.apps.Fop; +import org.apache.fop.apps.FopFactory; import org.apache.fop.apps.MimeConstants; import org.apache.fop.cli.InputHandler; @@ -38,6 +40,8 @@ import org.apache.fop.cli.InputHandler; */ public class BasicDriverTestCase extends AbstractFOPTestCase { + private FopFactory fopFactory = FopFactory.newInstance(); + /** * @see junit.framework.TestCase#TestCase(String) */ @@ -50,10 +54,10 @@ public class BasicDriverTestCase extends AbstractFOPTestCase { * @throws Exception if anything fails */ public void testFO2PDFWithJAXP() throws Exception { + FOUserAgent foUserAgent = fopFactory.newFOUserAgent(); File foFile = new File(getBaseDir(), "test/xml/bugtests/block.fo"); ByteArrayOutputStream baout = new ByteArrayOutputStream(); - Fop fop = new Fop(MimeConstants.MIME_PDF); - fop.setOutputStream(baout); + Fop fop = fopFactory.newFop(MimeConstants.MIME_PDF, foUserAgent, baout); TransformerFactory factory = TransformerFactory.newInstance(); Transformer transformer = factory.newTransformer(); //Identity transf. @@ -69,10 +73,10 @@ public class BasicDriverTestCase extends AbstractFOPTestCase { * @throws Exception if anything fails */ public void testFO2PSWithJAXP() throws Exception { + FOUserAgent foUserAgent = fopFactory.newFOUserAgent(); File foFile = new File(getBaseDir(), "test/xml/bugtests/block.fo"); ByteArrayOutputStream baout = new ByteArrayOutputStream(); - Fop fop = new Fop(MimeConstants.MIME_POSTSCRIPT); - fop.setOutputStream(baout); + Fop fop = fopFactory.newFop(MimeConstants.MIME_POSTSCRIPT, foUserAgent, baout); TransformerFactory factory = TransformerFactory.newInstance(); Transformer transformer = factory.newTransformer(); //Identity transf. @@ -88,10 +92,10 @@ public class BasicDriverTestCase extends AbstractFOPTestCase { * @throws Exception if anything fails */ public void testFO2RTFWithJAXP() throws Exception { + FOUserAgent foUserAgent = fopFactory.newFOUserAgent(); File foFile = new File(getBaseDir(), "test/xml/bugtests/block.fo"); ByteArrayOutputStream baout = new ByteArrayOutputStream(); - Fop fop = new Fop(MimeConstants.MIME_RTF); - fop.setOutputStream(baout); + Fop fop = new Fop(MimeConstants.MIME_RTF, foUserAgent, baout); TransformerFactory factory = TransformerFactory.newInstance(); Transformer transformer = factory.newTransformer(); //Identity transf. @@ -107,12 +111,13 @@ public class BasicDriverTestCase extends AbstractFOPTestCase { * @throws Exception if anything fails */ public void testFO2PDFWithXSLTInputHandler() throws Exception { + FOUserAgent foUserAgent = fopFactory.newFOUserAgent(); File xmlFile = new File(getBaseDir(), "test/xml/1.xml"); File xsltFile = new File(getBaseDir(), "test/xsl/doc.xsl"); ByteArrayOutputStream baout = new ByteArrayOutputStream(); InputHandler handler = new InputHandler(xmlFile, xsltFile, null); - handler.renderTo(null, MimeConstants.MIME_PDF, baout); + handler.renderTo(foUserAgent, MimeConstants.MIME_PDF, baout); assertTrue("Generated PDF has zero length", baout.size() > 0); } diff --git a/test/java/org/apache/fop/GenericFOPTestCase.java b/test/java/org/apache/fop/GenericFOPTestCase.java index 7c8a65f4d..fce23a499 100644 --- a/test/java/org/apache/fop/GenericFOPTestCase.java +++ b/test/java/org/apache/fop/GenericFOPTestCase.java @@ -1,5 +1,5 @@ /* - * Copyright 1999-2005 The Apache Software Foundation. + * Copyright 1999-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. @@ -115,8 +115,7 @@ public final class GenericFOPTestCase extends TestCase { MessageDigest outDigest = MessageDigest.getInstance("MD5"); DigestOutputStream out = new DigestOutputStream(new ByteArrayOutputStream(), outDigest); - Fop fop = new Fop(MimeConstants.MIME_PDF, foUserAgent); - fop.setOutputStream(out); + Fop fop = new Fop(MimeConstants.MIME_PDF, foUserAgent, out); InputSource source = new InputSource(new StringReader(fo)); DigestFilter filter = new DigestFilter("MD5"); filter.setParent(parserFactory.newSAXParser().getXMLReader()); diff --git a/test/java/org/apache/fop/URIResolutionTestCase.java b/test/java/org/apache/fop/URIResolutionTestCase.java index 0779bda29..108bb0279 100644 --- a/test/java/org/apache/fop/URIResolutionTestCase.java +++ b/test/java/org/apache/fop/URIResolutionTestCase.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. @@ -117,10 +117,9 @@ public class URIResolutionTestCase extends AbstractFOPTestCase { ua.setURIResolver(resolver); ua.setBaseURL(foFile.getParentFile().toURL().toString()); - Fop fop = new Fop(MimeConstants.MIME_PDF, ua); - ByteArrayOutputStream baout = new ByteArrayOutputStream(); - fop.setOutputStream(baout); + + Fop fop = new Fop(MimeConstants.MIME_PDF, ua, baout); Transformer transformer = tfactory.newTransformer(); //Identity transf. Source src = new StreamSource(foFile); diff --git a/test/java/org/apache/fop/threading/FOProcessorImpl.java b/test/java/org/apache/fop/threading/FOProcessorImpl.java index 51c76584a..2954192a5 100644 --- a/test/java/org/apache/fop/threading/FOProcessorImpl.java +++ b/test/java/org/apache/fop/threading/FOProcessorImpl.java @@ -1,5 +1,5 @@ /* - * Copyright 2004-2005 The Apache Software Foundation. + * Copyright 2004-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. @@ -35,8 +35,10 @@ import org.apache.avalon.framework.configuration.Configurable; import org.apache.avalon.framework.configuration.Configuration; import org.apache.avalon.framework.configuration.ConfigurationException; +import org.apache.fop.apps.FOUserAgent; import org.apache.fop.apps.Fop; import org.apache.fop.apps.FOPException; +import org.apache.fop.apps.FopFactory; import org.apache.fop.apps.MimeConstants; import org.apache.avalon.framework.activity.Initializable; @@ -84,8 +86,9 @@ public class FOProcessorImpl extends AbstractLogEnabled public void process(InputStream in, Templates templates, OutputStream out) throws org.apache.fop.apps.FOPException, java.io.IOException { - Fop fop = new Fop(MimeConstants.MIME_PDF); - fop.setOutputStream(out); + FopFactory fopFactory = FopFactory.newInstance(); + FOUserAgent foUserAgent = fopFactory.newFOUserAgent(); + Fop fop = new Fop(MimeConstants.MIME_PDF, foUserAgent, out); try { Transformer transformer; diff --git a/test/java/org/apache/fop/visual/AbstractPSPDFBitmapProducer.java b/test/java/org/apache/fop/visual/AbstractPSPDFBitmapProducer.java index 8e893fea9..c65d61cc7 100644 --- a/test/java/org/apache/fop/visual/AbstractPSPDFBitmapProducer.java +++ b/test/java/org/apache/fop/visual/AbstractPSPDFBitmapProducer.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. @@ -118,8 +118,7 @@ public abstract class AbstractPSPDFBitmapProducer extends AbstractBitmapProducer OutputStream out = new FileOutputStream(tempOut); out = new BufferedOutputStream(out); try { - Fop fop = new Fop(getTargetFormat(), userAgent); - fop.setOutputStream(out); + Fop fop = new Fop(getTargetFormat(), userAgent, out); SAXResult res = new SAXResult(fop.getDefaultHandler()); Transformer transformer = getTransformer(context); diff --git a/test/java/org/apache/fop/visual/BitmapProducerJava2D.java b/test/java/org/apache/fop/visual/BitmapProducerJava2D.java index 06f3b6b5e..83f74a1a0 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. @@ -69,8 +69,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 = new Fop(MimeConstants.MIME_PNG, userAgent, out); SAXResult res = new SAXResult(fop.getDefaultHandler()); Transformer transformer = getTransformer(context); |