diff options
author | Jeremias Maerki <jeremias@apache.org> | 2003-11-08 15:16:53 +0000 |
---|---|---|
committer | Jeremias Maerki <jeremias@apache.org> | 2003-11-08 15:16:53 +0000 |
commit | 926caf5957bb9815413f97ddb00e55b5c8920fdc (patch) | |
tree | 064d02600c242cae510743f6a5b0b3e68e84678b | |
parent | a54d46b762f24f3702e695850a9d21257f7574d9 (diff) | |
download | xmlgraphics-fop-926caf5957bb9815413f97ddb00e55b5c8920fdc.tar.gz xmlgraphics-fop-926caf5957bb9815413f97ddb00e55b5c8920fdc.zip |
Now all setup code is moved from render() to getContentHandler() except for the FOTreeListener.
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@196998 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r-- | src/java/org/apache/fop/apps/Driver.java | 33 |
1 files changed, 17 insertions, 16 deletions
diff --git a/src/java/org/apache/fop/apps/Driver.java b/src/java/org/apache/fop/apps/Driver.java index a49c641c5..48cbcc761 100644 --- a/src/java/org/apache/fop/apps/Driver.java +++ b/src/java/org/apache/fop/apps/Driver.java @@ -514,8 +514,9 @@ public class Driver implements LogEnabled { * renderers (e.g. PDF & PostScript) use a ContentHandler that builds an FO * Tree. * @return a SAX ContentHandler for handling the SAX events. + * @throws FOPException if setting up the ContentHandler fails */ - public ContentHandler getContentHandler() { + public ContentHandler getContentHandler() throws FOPException { if (!isInitialized()) { initialize(); } @@ -542,6 +543,21 @@ public class Driver implements LogEnabled { "Renderer not set when using standard foInputHandler"); } foInputHandler = new FOTreeHandler(currentDocument, true); + currentDocument.areaTree = new AreaTree(currentDocument); + currentDocument.atModel = new RenderPagesModel(renderer); + //this.atModel = new CachedRenderPagesModel(renderer); + currentDocument.areaTree.setTreeModel(currentDocument.atModel); + try { + renderer.setupFontInfo(currentDocument); + // check that the "any,normal,400" font exists + if (!currentDocument.isSetupValid()) { + throw new FOPException( + "No default font defined by OutputConverter"); + } + renderer.startRenderer(stream); + } catch (IOException e) { + throw new FOPException(e); + } } currentDocument.foInputHandler = foInputHandler; /** LayoutStrategy is hard-wired for now, but needs to be made @@ -588,21 +604,6 @@ public class Driver implements LogEnabled { if (foInputHandler instanceof FOTreeHandler) { FOTreeHandler foTreeHandler = (FOTreeHandler)foInputHandler; foTreeHandler.addFOTreeListener(currentDocument); - currentDocument.areaTree = new AreaTree(currentDocument); - currentDocument.atModel = new RenderPagesModel(renderer); - //this.atModel = new CachedRenderPagesModel(renderer); - currentDocument.areaTree.setTreeModel(currentDocument.atModel); - try { - renderer.setupFontInfo(currentDocument); - // check that the "any,normal,400" font exists - if (!currentDocument.isSetupValid()) { - throw new SAXException(new FOPException( - "No default font defined by OutputConverter")); - } - renderer.startRenderer(stream); - } catch (IOException e) { - throw new SAXException(e); - } } /** The following statement triggers virtually all of the processing |