From: Glen Mazza Date: Sun, 12 Dec 2004 14:14:56 +0000 (+0000) Subject: Moved PDF bookmark creation to endDocument(). (Fixed bug, was being X-Git-Tag: Root_Temp_KnuthStylePageBreaking~309 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=e38ff1dc2bd6aed01395782e28d940063da213f2;p=xmlgraphics-fop.git Moved PDF bookmark creation to endDocument(). (Fixed bug, was being created after each page sequence in document.) git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@198198 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/src/java/org/apache/fop/area/AreaTreeHandler.java b/src/java/org/apache/fop/area/AreaTreeHandler.java index 572793e9b..3439baa54 100644 --- a/src/java/org/apache/fop/area/AreaTreeHandler.java +++ b/src/java/org/apache/fop/area/AreaTreeHandler.java @@ -39,6 +39,7 @@ import org.apache.fop.fo.FOEventHandler; import org.apache.fop.fo.extensions.Outline; import org.apache.fop.fo.extensions.Bookmarks; import org.apache.fop.fo.pagination.PageSequence; +import org.apache.fop.fo.pagination.Root; import org.apache.fop.layoutmgr.PageSequenceLayoutManager; /** @@ -78,6 +79,9 @@ public class AreaTreeHandler extends FOEventHandler { // AreaTreeModel in use private AreaTreeModel model; + // The fo:root node of the document + private Root rootFObj; + // HashMap of ID's whose area is located on one or more PageViewports // Each ID has an arraylist of PageViewports sharing the area with this ID private Map idLocations = new HashMap(); @@ -193,6 +197,8 @@ public class AreaTreeHandler extends FOEventHandler { * @throws SAXException if there is some error */ public void endDocument() throws SAXException { + addBookmarks(rootFObj.getBookmarks()); + model.endDocument(); if (outputStatistics) { @@ -224,9 +230,10 @@ public class AreaTreeHandler extends FOEventHandler { log.debug("Current heap size: " + (memoryNow / 1024L) + "Kb"); } + rootFObj = pageSequence.getRoot(); + // If no main flow, nothing to layout! if (pageSequence.getMainFlow() != null) { - addBookmarks(pageSequence.getRoot().getBookmarks()); PageSequenceLayoutManager pageSLM = new PageSequenceLayoutManager(this, pageSequence); pageSLM.run();