/*\r
- * Copyright 1999-2005 The Apache Software Foundation.\r
+ * Copyright 1999-2006 The Apache Software Foundation.\r
* \r
* Licensed under the Apache License, Version 2.0 (the "License");\r
* you may not use this file except in compliance with the License.\r
import org.apache.fop.apps.FOUserAgent;\r
import org.apache.fop.apps.Fop;\r
import org.apache.fop.apps.FOPException;\r
+import org.apache.fop.apps.FopFactory;\r
import org.apache.fop.apps.MimeConstants;\r
import org.apache.fop.render.print.PrintRenderer;\r
\r
*/\r
public class ExampleFO2OldStylePrint {\r
\r
+ // configure fopFactory as desired\r
+ private FopFactory fopFactory = FopFactory.newInstance();\r
+ \r
/**\r
* Prints an FO file using an old-style PrinterJob.\r
* @param fo the FO file\r
\r
try {\r
//Set up a custom user agent so we can supply our own renderer instance\r
- FOUserAgent userAgent = new FOUserAgent();\r
+ FOUserAgent userAgent = fopFactory.newFOUserAgent();\r
userAgent.setRendererOverride(renderer);\r
\r
// Construct fop with desired output format\r
try {
//Setup fonts and user agent
FontInfo fontInfo = new FontInfo();
- FOUserAgent userAgent = new FOUserAgent();
+ FOUserAgent userAgent = fopFactory.newFOUserAgent();
//Construct the AreaTreeModel that will received the individual pages
AreaTreeModel treeModel = new RenderPagesModel(userAgent,
import javax.xml.transform.stream.StreamSource;
import org.apache.fop.apps.FOUserAgent;
+import org.apache.fop.apps.FopFactory;
import org.apache.fop.apps.MimeConstants;
import org.apache.fop.area.AreaTreeModel;
import org.apache.fop.area.AreaTreeParser;
*/
public class ExampleStamp {
+ // configure fopFactory as desired
+ private FopFactory fopFactory = FopFactory.newInstance();
+
/**
* Stamps an intermediate file and renders it to a PDF file.
* @param atfile the intermediate file (area tree XML)
try {
//Setup fonts and user agent
FontInfo fontInfo = new FontInfo();
- FOUserAgent userAgent = new FOUserAgent();
+ FOUserAgent userAgent = fopFactory.newFOUserAgent();
//Construct the AreaTreeModel that will received the individual pages
AreaTreeModel treeModel = new RenderPagesModel(userAgent,
protected String keywords = null;
/**
- * Default constructor. <b>Provided for compatibility only. Please use the methods from
- * FopFactory to construct FOUserAgent instances!</b>
+ * Default constructor
* @see org.apache.fop.apps.FopFactory
+ * @deprecated Provided for compatibility only. Please use the methods from
+ * FopFactory to construct FOUserAgent instances!
*/
public FOUserAgent() {
this(FopFactory.newInstance());
/*
- * 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.
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
-import org.apache.fop.apps.Fop;
+import org.apache.fop.apps.FopFactory;
import org.apache.fop.apps.FOUserAgent;
import org.apache.fop.apps.MimeConstants;
import org.apache.fop.cli.InputHandler;
*/
public class TestConverter {
+ // configure fopFactory as desired
+ private FopFactory fopFactory = FopFactory.newInstance();
+
private boolean failOnly = false;
private String outputFormat = MimeConstants.MIME_FOP_AREA_TREE;
private File destdir;
+ xsl), null);
}
- FOUserAgent userAgent = new FOUserAgent();
+ FOUserAgent userAgent = fopFactory.newFOUserAgent();
userAgent.setBaseURL(baseURL);
userAgent.getRendererOptions().put("fineDetail", new Boolean(false));
/*
- * 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.
// FOP
import org.apache.fop.apps.FOPException;
import org.apache.fop.apps.FOUserAgent;
+import org.apache.fop.apps.FopFactory;
import org.apache.fop.apps.MimeConstants;
import org.apache.fop.cli.InputHandler;
class FOPTaskStarter {
+ // configure fopFactory as desired
+ private FopFactory fopFactory = FopFactory.newInstance();
+
private Fop task;
private String baseURL = null;
}
try {
- FOUserAgent userAgent = new FOUserAgent();
+ FOUserAgent userAgent = fopFactory.newFOUserAgent();
userAgent.setBaseURL(this.baseURL);
inputHandler.renderTo(userAgent, outputFormat, out);
} catch (Exception ex) {
import org.apache.fop.apps.Fop;
import org.apache.fop.apps.FOUserAgent;
+import org.apache.fop.apps.FopFactory;
import org.apache.fop.apps.MimeConstants;
import org.apache.fop.util.DigestFilter;
import org.xml.sax.InputSource;
*/
public final class GenericFOPTestCase extends TestCase {
+ // configure fopFactory as desired
+ private FopFactory fopFactory = FopFactory.newInstance();
+
protected SAXParserFactory parserFactory;
public static Test suite() {
private void renderPDF(String fo, String digestIn, String digestOut)
throws Exception {
- FOUserAgent foUserAgent = new FOUserAgent();
+ FOUserAgent foUserAgent = fopFactory.newFOUserAgent();
foUserAgent.setCreationDate(new Date(10000));
MessageDigest outDigest = MessageDigest.getInstance("MD5");
DigestOutputStream out =
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.image.ImageFactory;
import org.apache.fop.render.xml.XMLRenderer;
import org.apache.xpath.XPathAPI;
import org.apache.xpath.objects.XObject;
*/
public class URIResolutionTestCase extends AbstractFOPTestCase {
+ // configure fopFactory as desired
+ private FopFactory fopFactory = FopFactory.newInstance();
+
private SAXTransformerFactory tfactory
= (SAXTransformerFactory)SAXTransformerFactory.newInstance();
}
private void innerTestFO1(boolean withStream) throws Exception {
- FOUserAgent ua = new FOUserAgent();
+ FOUserAgent ua = fopFactory.newFOUserAgent();
//Reset the image caches to force URI resolution!
ua.getFactory().getImageFactory().clearCaches();
//TODO This will only work when we can do URI resolution inside Batik!
File foFile = new File(getBaseDir(), "test/xml/uri-resolution2.fo");
- FOUserAgent ua = new FOUserAgent();
+ FOUserAgent ua = fopFactory.newFOUserAgent();
MyURIResolver resolver = new MyURIResolver(false);
ua.setURIResolver(resolver);
ua.setBaseURL(foFile.getParentFile().toURL().toString());
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.area.AreaTreeModel;
import org.apache.fop.area.AreaTreeParser;
*/
public class AreaTreeParserTestCase extends XMLTestCase {
+ // configure fopFactory as desired
+ private FopFactory fopFactory = FopFactory.newInstance();
+
private static SAXTransformerFactory tFactory
= (SAXTransformerFactory)SAXTransformerFactory.newInstance();
private static Templates stylesheet = null;
}
private FOUserAgent createUserAgent() {
- FOUserAgent userAgent = new FOUserAgent();
+ FOUserAgent userAgent = fopFactory.newFOUserAgent();
try {
userAgent.setBaseURL(testDir.toURL().toExternalForm());
} catch (MalformedURLException e) {
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.FormattingResults;
import org.apache.fop.apps.MimeConstants;
import org.apache.fop.layoutmgr.ElementListObserver;
private static final Map CHECK_CLASSES = new java.util.HashMap();
+ // configure fopFactory as desired
+ private FopFactory fopFactory = FopFactory.newInstance();
+
private SAXTransformerFactory tfactory
= (SAXTransformerFactory)SAXTransformerFactory.newInstance();
athandler.setResult(domres);
//Setup FOP for area tree rendering
- FOUserAgent ua = new FOUserAgent();
+ FOUserAgent ua = fopFactory.newFOUserAgent();
ua.setBaseURL(testFile.getParentFile().toURL().toString());
XMLRenderer atrenderer = new XMLRenderer();
atrenderer.setUserAgent(ua);
import org.apache.commons.io.IOUtils;
import org.apache.fop.apps.FOUserAgent;
import org.apache.fop.apps.Fop;
+import org.apache.fop.apps.FopFactory;
/**
* BitmapProducer implementation that uses the PS or PDF renderer and an external converter
public abstract class AbstractPSPDFBitmapProducer extends AbstractBitmapProducer
implements Configurable {
+ // configure fopFactory as desired
+ private FopFactory fopFactory = FopFactory.newInstance();
+
private String converter;
private boolean deleteTempFiles;
/** @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());
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;
/**
*/
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 */
/** @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());