diff options
-rw-r--r-- | src/java/org/apache/fop/apps/CommandLineOptions.java | 95 | ||||
-rw-r--r-- | src/java/org/apache/fop/apps/Driver.java | 136 | ||||
-rw-r--r-- | src/java/org/apache/fop/apps/FOUserAgent.java | 2 | ||||
-rw-r--r-- | src/java/org/apache/fop/apps/Fop.java | 2 | ||||
-rw-r--r-- | src/java/org/apache/fop/fo/Constants.java | 32 | ||||
-rw-r--r-- | src/java/org/apache/fop/fo/FOTreeBuilder.java | 8 | ||||
-rw-r--r-- | src/java/org/apache/fop/fo/FObj.java | 34 | ||||
-rw-r--r-- | src/java/org/apache/fop/fo/pagination/Flow.java | 30 | ||||
-rw-r--r-- | src/java/org/apache/fop/fo/pagination/LayoutMasterSet.java | 2 | ||||
-rw-r--r-- | src/java/org/apache/fop/render/awt/viewer/PreviewDialog.java | 3 | ||||
-rw-r--r-- | test/java/org/apache/fop/GenericFOPTestCase.java | 5 |
11 files changed, 157 insertions, 192 deletions
diff --git a/src/java/org/apache/fop/apps/CommandLineOptions.java b/src/java/org/apache/fop/apps/CommandLineOptions.java index 2497131cb..0689702b3 100644 --- a/src/java/org/apache/fop/apps/CommandLineOptions.java +++ b/src/java/org/apache/fop/apps/CommandLineOptions.java @@ -23,6 +23,8 @@ import java.io.FileNotFoundException; import java.util.Locale; import java.util.Vector; +import org.apache.fop.fo.Constants; + import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.commons.logging.impl.SimpleLog; @@ -30,34 +32,7 @@ import org.apache.commons.logging.impl.SimpleLog; /** * Options parses the commandline arguments */ -public class CommandLineOptions { - - /** input / output not set */ - public static final int NOT_SET = 0; - /** input: fo file */ - public static final int FO_INPUT = 1; - /** input: xml+xsl file */ - public static final int XSLT_INPUT = 2; - /** output: pdf file */ - public static final int PDF_OUTPUT = 1; - /** output: screen using swing */ - public static final int AWT_OUTPUT = 2; - /** output: mif file */ - public static final int MIF_OUTPUT = 3; - /** output: sent swing rendered file to printer */ - public static final int PRINT_OUTPUT = 4; - /** output: pcl file */ - public static final int PCL_OUTPUT = 5; - /** output: postscript file */ - public static final int PS_OUTPUT = 6; - /** output: text file */ - public static final int TXT_OUTPUT = 7; - /** output: svg file */ - public static final int SVG_OUTPUT = 8; - /** output: XML area tree */ - public static final int AREA_OUTPUT = 9; - /** output: RTF file */ - public static final int RTF_OUTPUT = 10; +public class CommandLineOptions implements Constants { /* show configuration information */ private Boolean showConfiguration = Boolean.FALSE; @@ -257,12 +232,12 @@ public class CommandLineOptions { } private int parseAWTOutputOption(String[] args, int i) throws FOPException { - setOutputMode(AWT_OUTPUT); + setOutputMode(RENDER_AWT); return 0; } private int parsePDFOutputOption(String[] args, int i) throws FOPException { - setOutputMode(PDF_OUTPUT); + setOutputMode(RENDER_PDF); if ((i + 1 == args.length) || (args[i + 1].charAt(0) == '-')) { throw new FOPException("you must specify the pdf output file"); @@ -273,7 +248,7 @@ public class CommandLineOptions { } private int parseMIFOutputOption(String[] args, int i) throws FOPException { - setOutputMode(MIF_OUTPUT); + setOutputMode(RENDER_MIF); if ((i + 1 == args.length) || (args[i + 1].charAt(0) == '-')) { throw new FOPException("you must specify the mif output file"); @@ -284,7 +259,7 @@ public class CommandLineOptions { } private int parseRTFOutputOption(String[] args, int i) throws FOPException { - setOutputMode(RTF_OUTPUT); + setOutputMode(RENDER_RTF); if ((i + 1 == args.length) || (args[i + 1].charAt(0) == '-')) { throw new FOPException("you must specify the rtf output file"); @@ -295,12 +270,12 @@ public class CommandLineOptions { } private int parsePrintOutputOption(String[] args, int i) throws FOPException { - setOutputMode(PRINT_OUTPUT); + setOutputMode(RENDER_PRINT); return 0; } private int parsePCLOutputOption(String[] args, int i) throws FOPException { - setOutputMode(PCL_OUTPUT); + setOutputMode(RENDER_PCL); if ((i + 1 == args.length) || (args[i + 1].charAt(0) == '-')) { throw new FOPException("you must specify the pdf output file"); @@ -311,7 +286,7 @@ public class CommandLineOptions { } private int parsePostscriptOutputOption(String[] args, int i) throws FOPException { - setOutputMode(PS_OUTPUT); + setOutputMode(RENDER_PS); if ((i + 1 == args.length) || (args[i + 1].charAt(0) == '-')) { throw new FOPException("you must specify the PostScript output file"); @@ -322,7 +297,7 @@ public class CommandLineOptions { } private int parseTextOutputOption(String[] args, int i) throws FOPException { - setOutputMode(TXT_OUTPUT); + setOutputMode(RENDER_TXT); if ((i + 1 == args.length) || (args[i + 1].charAt(0) == '-')) { throw new FOPException("you must specify the text output file"); @@ -333,7 +308,7 @@ public class CommandLineOptions { } private int parseSVGOutputOption(String[] args, int i) throws FOPException { - setOutputMode(SVG_OUTPUT); + setOutputMode(RENDER_SVG); if ((i + 1 == args.length) || (args[i + 1].charAt(0) == '-')) { throw new FOPException("you must specify the svg output file"); @@ -348,7 +323,7 @@ public class CommandLineOptions { inputmode = FO_INPUT; fofile = new File(args[i]); } else if (outputmode == NOT_SET) { - outputmode = PDF_OUTPUT; + outputmode = RENDER_PDF; outfile = new File(args[i]); } else { throw new FOPException("Don't know what to do with " @@ -358,7 +333,7 @@ public class CommandLineOptions { } private int parseAreaTreeOption(String[] args, int i) throws FOPException { - setOutputMode(AREA_OUTPUT); + setOutputMode(RENDER_XML); if ((i + 1 == args.length) || (args[i + 1].charAt(0) == '-')) { throw new FOPException("you must specify the area-tree output file"); @@ -388,7 +363,7 @@ public class CommandLineOptions { throw new FOPException("No output file specified"); } - if ((outputmode == AWT_OUTPUT || outputmode == PRINT_OUTPUT) && outfile != null) { + if ((outputmode == RENDER_AWT || outputmode == RENDER_PRINT) && outfile != null) { throw new FOPException("Output file may not be specified " + "for AWT or PRINT output"); } @@ -446,26 +421,26 @@ public class CommandLineOptions { switch (outputmode) { case NOT_SET: throw new FOPException("Renderer has not been set!"); - case PDF_OUTPUT: + case RENDER_PDF: return Driver.RENDER_PDF; - case AWT_OUTPUT: + case RENDER_AWT: return Driver.RENDER_AWT; - case MIF_OUTPUT: + case RENDER_MIF: return Driver.RENDER_MIF; - case PRINT_OUTPUT: + case RENDER_PRINT: return Driver.RENDER_PRINT; - case PCL_OUTPUT: + case RENDER_PCL: return Driver.RENDER_PCL; - case PS_OUTPUT: + case RENDER_PS: return Driver.RENDER_PS; - case TXT_OUTPUT: + case RENDER_TXT: return Driver.RENDER_TXT; - case SVG_OUTPUT: + case RENDER_SVG: return Driver.RENDER_SVG; - case AREA_OUTPUT: + case RENDER_XML: foUserAgent.getRendererOptions().put("fineDetail", isCoarseAreaXml()); return Driver.RENDER_XML; - case RTF_OUTPUT: + case RENDER_RTF: return Driver.RENDER_RTF; default: throw new FOPException("Invalid Renderer setting!"); @@ -505,7 +480,7 @@ public class CommandLineOptions { } /** - * Returns the output mode (output format, ex. NOT_SET or PDF_OUTPUT) + * Returns the output mode (output format, ex. NOT_SET or RENDER_PDF) * @return the output mode */ public int getOutputMode() { @@ -653,45 +628,45 @@ public class CommandLineOptions { case NOT_SET: log.info("not set"); break; - case PDF_OUTPUT: + case RENDER_PDF: log.info("pdf"); log.info("output file: " + outfile.toString()); break; - case AWT_OUTPUT: + case RENDER_AWT: log.info("awt on screen"); if (outfile != null) { log.error("awt mode, but outfile is set:"); log.info("out file: " + outfile.toString()); } break; - case MIF_OUTPUT: + case RENDER_MIF: log.info("mif"); log.info("output file: " + outfile.toString()); break; - case RTF_OUTPUT: + case RENDER_RTF: log.info("rtf"); log.info("output file: " + outfile.toString()); break; - case PRINT_OUTPUT: + case RENDER_PRINT: log.info("print directly"); if (outfile != null) { log.error("print mode, but outfile is set:"); log.error("out file: " + outfile.toString()); } break; - case PCL_OUTPUT: + case RENDER_PCL: log.info("pcl"); log.info("output file: " + outfile.toString()); break; - case PS_OUTPUT: + case RENDER_PS: log.info("PostScript"); log.info("output file: " + outfile.toString()); break; - case TXT_OUTPUT: + case RENDER_TXT: log.info("txt"); log.info("output file: " + outfile.toString()); break; - case SVG_OUTPUT: + case RENDER_SVG: log.info("svg"); log.info("output file: " + outfile.toString()); break; diff --git a/src/java/org/apache/fop/apps/Driver.java b/src/java/org/apache/fop/apps/Driver.java index 2a96d8039..e1287740e 100644 --- a/src/java/org/apache/fop/apps/Driver.java +++ b/src/java/org/apache/fop/apps/Driver.java @@ -30,6 +30,7 @@ import org.xml.sax.XMLReader; import org.w3c.dom.Document; // FOP +import org.apache.fop.fo.Constants; import org.apache.fop.fo.ElementMapping; import org.apache.fop.fo.FOTreeBuilder; import org.apache.fop.fo.FOInputHandler; @@ -86,62 +87,7 @@ import org.apache.fop.tools.DocumentReader; * driver.render(parser, fileInputSource(args[0])); * </PRE> */ -public class Driver { - - /** - * private constant to indicate renderer was not defined. - */ - private static final int NOT_SET = 0; - - /** - * Render to PDF. OutputStream must be set - */ - public static final int RENDER_PDF = 1; - - /** - * Render to a GUI window. No OutputStream neccessary - */ - public static final int RENDER_AWT = 2; - - /** - * Render to MIF. OutputStream must be set - */ - public static final int RENDER_MIF = 3; - - /** - * Render to XML. OutputStream must be set - */ - public static final int RENDER_XML = 4; - - /** - * Render to PRINT. No OutputStream neccessary - */ - public static final int RENDER_PRINT = 5; - - /** - * Render to PCL. OutputStream must be set - */ - public static final int RENDER_PCL = 6; - - /** - * Render to Postscript. OutputStream must be set - */ - public static final int RENDER_PS = 7; - - /** - * Render to Text. OutputStream must be set - */ - public static final int RENDER_TXT = 8; - - /** - * Render to SVG. OutputStream must be set - */ - public static final int RENDER_SVG = 9; - - /** - * Render to RTF. OutputStream must be set - */ - public static final int RENDER_RTF = 10; +public class Driver implements Constants { /** * the FO tree builder @@ -191,6 +137,15 @@ public class Driver { } /** + * Constructor for AWTRenderer, which reuses the + * same renderer instance for document reloading + */ + public Driver(AWTRenderer renderer) { + this(); + setRenderer(renderer); + } + + /** * Convenience constructor for directly setting input and output. * @param source InputSource to take the XSL-FO input from * @param stream Target output stream @@ -222,8 +177,15 @@ public class Driver { */ public void setUserAgent(FOUserAgent agent) { userAgent = agent; + if (renderer != null) { + renderer.setUserAgent(userAgent); + } } + /** + * Get the FOUserAgent instance for this process + * @return the user agent + */ public FOUserAgent getUserAgent() { if (userAgent == null) { userAgent = new FOUserAgent(); @@ -246,14 +208,6 @@ public class Driver { } /** - * Indicates whether FOP has already received input data. - * @return true, if input data was received - */ - public boolean hasData() { - return (treeBuilder.hasData()); - } - - /** * Set the OutputStream to use to output the result of the Renderer * (if applicable) * @param stream the stream to output the result of rendering to @@ -287,7 +241,7 @@ public class Driver { } /** - * Shortcut to set the rendering type to use. Must be one of + * Method to set the rendering type to use. Must be one of * <ul> * <li>RENDER_PDF</li> * <li>RENDER_AWT</li> @@ -307,31 +261,31 @@ public class Driver { rendererType = renderer; switch (renderer) { case RENDER_PDF: - setRenderer("org.apache.fop.render.pdf.PDFRenderer"); + setRenderer(new org.apache.fop.render.pdf.PDFRenderer()); break; case RENDER_AWT: - setRenderer("org.apache.fop.render.awt.AWTRenderer"); + setRenderer(new org.apache.fop.render.awt.AWTRenderer()); break; case RENDER_PRINT: - setRenderer("org.apache.fop.render.awt.AWTPrintRenderer"); + setRenderer(new org.apache.fop.render.awt.AWTPrintRenderer()); break; case RENDER_PCL: - setRenderer("org.apache.fop.render.pcl.PCLRenderer"); + setRenderer(new org.apache.fop.render.pcl.PCLRenderer()); break; case RENDER_PS: - setRenderer("org.apache.fop.render.ps.PSRenderer"); + setRenderer(new org.apache.fop.render.ps.PSRenderer()); break; case RENDER_TXT: - setRenderer("org.apache.fop.render.txt.TXTRenderer()"); + setRenderer(new org.apache.fop.render.txt.TXTRenderer()); break; case RENDER_MIF: //foInputHandler will be set later break; case RENDER_XML: - setRenderer("org.apache.fop.render.xml.XMLRenderer"); + setRenderer(new org.apache.fop.render.xml.XMLRenderer()); break; case RENDER_SVG: - setRenderer("org.apache.fop.render.svg.SVGRenderer"); + setRenderer(new org.apache.fop.render.svg.SVGRenderer()); break; case RENDER_RTF: //foInputHandler will be set later @@ -346,46 +300,12 @@ public class Driver { * Set the Renderer to use. * @param renderer the renderer instance to use */ - public void setRenderer(Renderer renderer) { - // AWTStarter calls this function directly - if (renderer instanceof AWTRenderer) { - rendererType = RENDER_AWT; - } + private void setRenderer(Renderer renderer) { renderer.setUserAgent(getUserAgent()); - userAgent.setProducer("FOP Version" + Fop.getVersion()); this.renderer = renderer; } /** - * Set the class name of the Renderer to use as well as the - * producer string for those renderers that can make use of it. - * @param rendererClassName classname of the renderer to use such as - * "org.apache.fop.render.pdf.PDFRenderer" - * @exception IllegalArgumentException if the classname was invalid. - * @see #setRenderer(int) - */ - public void setRenderer(String rendererClassName) - throws IllegalArgumentException { - try { - renderer = (Renderer)Class.forName(rendererClassName).newInstance(); - renderer.setUserAgent(getUserAgent()); - userAgent.setProducer("FOP Version" + Fop.getVersion()); - } catch (ClassNotFoundException e) { - throw new IllegalArgumentException("Could not find " - + rendererClassName); - } catch (InstantiationException e) { - throw new IllegalArgumentException("Could not instantiate " - + rendererClassName); - } catch (IllegalAccessException e) { - throw new IllegalArgumentException("Could not access " - + rendererClassName); - } catch (ClassCastException e) { - throw new IllegalArgumentException(rendererClassName - + " is not a renderer"); - } - } - - /** * Add the given element mapping. * An element mapping maps element names to Java classes. * diff --git a/src/java/org/apache/fop/apps/FOUserAgent.java b/src/java/org/apache/fop/apps/FOUserAgent.java index b84d17bbc..45ca4f77f 100644 --- a/src/java/org/apache/fop/apps/FOUserAgent.java +++ b/src/java/org/apache/fop/apps/FOUserAgent.java @@ -64,7 +64,7 @@ public class FOUserAgent { /** Producer: Metadata element for the system/software that produces * the document. (Some renderers can store this in the document.) */ - protected String producer = "FOP " + Fop.getVersion(); + protected String producer = "FOP Version " + Fop.getVersion(); /** Creator: Metadata element for the user that created the * document. (Some renderers can store this in the document.) diff --git a/src/java/org/apache/fop/apps/Fop.java b/src/java/org/apache/fop/apps/Fop.java index 7376c9bbe..6db94af9e 100644 --- a/src/java/org/apache/fop/apps/Fop.java +++ b/src/java/org/apache/fop/apps/Fop.java @@ -64,7 +64,7 @@ public class Fop { // System.exit(0) called to close AWT/SVG-created threads, if any. // AWTRenderer closes with window shutdown, so exit() should not // be called here - if (options.getOutputMode() != CommandLineOptions.AWT_OUTPUT) { + if (options.getOutputMode() != CommandLineOptions.RENDER_AWT) { System.exit(0); } } catch (FOPException e) { diff --git a/src/java/org/apache/fop/fo/Constants.java b/src/java/org/apache/fop/fo/Constants.java index 5309bcf1a..3e9bd22ef 100644 --- a/src/java/org/apache/fop/fo/Constants.java +++ b/src/java/org/apache/fop/fo/Constants.java @@ -21,8 +21,38 @@ package org.apache.fop.fo; public interface Constants { + /* These constants are used by apps.CommandLineOptions and + apps.Driver to describe the input (either .FO or .XML/.XSL) + and desired output (PDF, PS, AWT, etc.) of the document */ + + /** input / output not set */ + int NOT_SET = 0; + /** input: fo file */ + int FO_INPUT = 1; + /** input: xml+xsl file */ + int XSLT_INPUT = 2; + /** output: pdf file */ + int RENDER_PDF = 1; + /** output: screen using swing */ + int RENDER_AWT = 2; + /** output: mif file */ + int RENDER_MIF = 3; + /** output: sent swing rendered file to printer */ + int RENDER_PRINT = 4; + /** output: pcl file */ + int RENDER_PCL = 5; + /** output: postscript file */ + int RENDER_PS = 6; + /** output: text file */ + int RENDER_TXT = 7; + /** output: svg file */ + int RENDER_SVG = 8; + /** output: XML area tree */ + int RENDER_XML = 9; + /** output: RTF file */ + int RENDER_RTF = 10; + // element constants - int FO_BASIC_LINK = 1; int FO_BIDI_OVERRIDE = 2; int FO_BLOCK = 3; diff --git a/src/java/org/apache/fop/fo/FOTreeBuilder.java b/src/java/org/apache/fop/fo/FOTreeBuilder.java index e8be41305..eef720a45 100644 --- a/src/java/org/apache/fop/fo/FOTreeBuilder.java +++ b/src/java/org/apache/fop/fo/FOTreeBuilder.java @@ -305,14 +305,6 @@ public class FOTreeBuilder extends DefaultHandler { foInputHandler = null; } - /** - * Indicates if data has been processed. - * @return True if data has been processed - */ - public boolean hasData() { - return (rootFObj != null); - } - } // code stolen from org.apache.batik.util and modified slightly diff --git a/src/java/org/apache/fop/fo/FObj.java b/src/java/org/apache/fop/fo/FObj.java index ac90c68a8..ec4864fac 100644 --- a/src/java/org/apache/fop/fo/FObj.java +++ b/src/java/org/apache/fop/fo/FObj.java @@ -441,5 +441,39 @@ public class FObj extends FONode implements Constants { return null; } + /** + * Convenience method for validity checking. Checks if the + * incoming node is a member of the "%block;" parameter entity + * as defined in Sect. 6.2 of the XSL 1.0 & 1.1 Recommendations + * @param nsURI namespace URI of incoming invalid node + * @param lName local name (i.e., no prefix) of incoming node + * @return true if a member, false if not + */ + protected static boolean isBlockItem(String nsURI, String lName) { + return (nsURI == FOElementMapping.URI && + (lName.equals("block") + || lName.equals("table") + || lName.equals("table-and-caption") + || lName.equals("block-container") + || lName.equals("list-block") + || lName.equals("float"))) + || isNeutralItem(nsURI, lName); + } + + /** + * Convenience method for validity checking. Checks if the + * incoming node is a member of the neutral item list + * as defined in Sect. 6.2 of the XSL 1.0 & 1.1 Recommendations + * @param nsURI namespace URI of incoming invalid node + * @param lName local name (i.e., no prefix) of incoming node + * @return true if a member, false if not + */ + protected static boolean isNeutralItem(String nsURI, String lName) { + return (nsURI == FOElementMapping.URI && + (lName.equals("multi-switch") + || lName.equals("multi-properties") + || lName.equals("wrapper") + || lName.equals("retrieve-marker"))); + } } diff --git a/src/java/org/apache/fop/fo/pagination/Flow.java b/src/java/org/apache/fop/fo/pagination/Flow.java index ac2911e9d..d7cc88cf3 100644 --- a/src/java/org/apache/fop/fo/pagination/Flow.java +++ b/src/java/org/apache/fop/fo/pagination/Flow.java @@ -23,6 +23,7 @@ import java.util.ArrayList; // XML import org.xml.sax.Attributes; +import org.xml.sax.Locator; // FOP import org.apache.fop.fo.FONode; @@ -63,6 +64,28 @@ public class Flow extends FObj { } /** + * @see org.apache.fop.fo.FONode#validateChildNode(Locator, String, String) + * XSL/FOP Content Model: (%block;)+ + */ + protected void validateChildNode(Locator loc, String nsURI, String localName) { + if (!isBlockItem(nsURI, localName)) { + invalidChildError(loc, nsURI, localName); + } + } + + /** + * Make sure content model satisfied, if so then tell the + * StructureRenderer that we are at the end of the flow. + * @see org.apache.fop.fo.FONode#end + */ + protected void end() { + if (children == null) { + missingChildElementError("(%block;)+"); + } + getFOInputHandler().endFlow(this); + } + + /** * @see org.apache.fop.fo.FObj#addProperties */ protected void addProperties(Attributes attlist) throws FOPException { @@ -96,13 +119,6 @@ public class Flow extends FObj { } /** - * Tell the StructureRenderer that we are at the end of the flow. - */ - protected void end() { - getFOInputHandler().endFlow(this); - } - - /** * @param name the name of the flow to set * @throws FOPException for an empty name */ diff --git a/src/java/org/apache/fop/fo/pagination/LayoutMasterSet.java b/src/java/org/apache/fop/fo/pagination/LayoutMasterSet.java index e2919c3de..a97cbae1e 100644 --- a/src/java/org/apache/fop/fo/pagination/LayoutMasterSet.java +++ b/src/java/org/apache/fop/fo/pagination/LayoutMasterSet.java @@ -74,7 +74,7 @@ public class LayoutMasterSet extends FObj { */ protected void end() { if (children == null) { - missingChildElementError("(simple-page-master|page-sequence-master)+"); + missingChildElementError("(simple-page-master|page-sequence-master)+"); } } diff --git a/src/java/org/apache/fop/render/awt/viewer/PreviewDialog.java b/src/java/org/apache/fop/render/awt/viewer/PreviewDialog.java index c1d06615c..8a09828f1 100644 --- a/src/java/org/apache/fop/render/awt/viewer/PreviewDialog.java +++ b/src/java/org/apache/fop/render/awt/viewer/PreviewDialog.java @@ -384,8 +384,7 @@ public class PreviewDialog extends JFrame { private class Reloader extends Thread { public void run() { if (driver == null) { - driver = new Driver(); - driver.setRenderer(renderer); + driver = new Driver(renderer); } else { driver.reset(); } diff --git a/test/java/org/apache/fop/GenericFOPTestCase.java b/test/java/org/apache/fop/GenericFOPTestCase.java index 370b012a9..dc78a3173 100644 --- a/test/java/org/apache/fop/GenericFOPTestCase.java +++ b/test/java/org/apache/fop/GenericFOPTestCase.java @@ -112,16 +112,15 @@ public final class GenericFOPTestCase extends TestCase { private void renderPDF(String fo, String digestIn, String digestOut) throws Exception { - PDFRenderer renderer = new PDFRenderer(); FOUserAgent foUserAgent = new FOUserAgent(); foUserAgent.setCreationDate(new Date(10000)); - renderer.setUserAgent(foUserAgent); MessageDigest outDigest = MessageDigest.getInstance("MD5"); ByteArrayOutputStream outBytes = new ByteArrayOutputStream(); DigestOutputStream out = new DigestOutputStream(new ByteArrayOutputStream(), outDigest); Driver driver = new Driver(); - driver.setRenderer(renderer); + driver.setUserAgent(foUserAgent); + driver.setRenderer(Driver.RENDER_PDF); driver.setOutputStream(out); InputSource source = new InputSource(new StringReader(fo)); DigestFilter filter = new DigestFilter("MD5"); |