A link from page A to page B is only rendered in the pdf renderer correctly if page B 
is prepared by the renderer before page A is rendered. In the following case page A is 
rendered before page B is prepared (PN (X) is the pagenumber of page X):

(i)  PN (A) < PN (B)
(ii) if there is a link from page A to page C then PN (C) <= PN (B)

Rainer Garus
diff -u -r xml-fop/src/org/apache/fop/area/AreaTree.java 
xml-fop-new/src/org/apache/fop/area/AreaTree.java
--- xml-fop/src/org/apache/fop/area/AreaTree.java       Mon Sep 16 12:28:22 2002
+++ xml-fop-new/src/org/apache/fop/area/AreaTree.java   Fri Nov  1 22:26:22 2002
@@ -396,32 +396,19 @@
         public void addPage(PageViewport page) {
             super.addPage(page);
 
-            // check prepared pages
-            boolean cont = checkPreparedPages();
+            renderer.preparePage(page);
+            prepared.add(page);
 
-            // if page finished
-            if (cont && page.isResolved()) {
-                try {
-                    renderer.renderPage(page);
-                } catch (Exception e) {
-                    // use error handler to handle this FOP or IO Exception
-                }
-                page.clear();
-            } else {
-                preparePage(page);
-            }
+            renderPreparedPages();
 
             renderExtensions(pendingExt);
             pendingExt.clear();
         }
 
         /**
-         * Check prepared pages
-         * @return true if the current page should be rendered
-         *         false if the renderer doesn't support out of order
-         *         rendering and there are pending pages
+         * Render resolved pending pages
          */
-        protected boolean checkPreparedPages() {
+        protected void renderPreparedPages() {
             for (Iterator iter = prepared.iterator(); iter.hasNext();) {
                 PageViewport p = (PageViewport)iter.next();
                 if (p.isResolved()) {
@@ -439,21 +426,8 @@
                     }
                 }
             }
-            return renderer.supportsOutOfOrder() || prepared.isEmpty();
         }
 
-        /**
-         * Prepare a page.
-         * An unresolved page can be prepared if the renderer supports
-         * it and the page will be rendered later.
-         * @param page the page to prepare
-         */
-        protected void preparePage(PageViewport page) {
-            if (renderer.supportsOutOfOrder()) {
-                renderer.preparePage(page);
-            }
-            prepared.add(page);
-        }
 
         /**
          * Add an extension to this model.
@@ -490,7 +464,7 @@
          */
         public void endDocument() {
             // render any pages that had unresolved ids
-            checkPreparedPages();
+            renderPreparedPages();
             renderExtensions(endDocExt);
         }
     }
diff -u -r xml-fop/src/org/apache/fop/render/AbstractRenderer.java 
xml-fop-new/src/org/apache/fop/render/AbstractRenderer.java
--- xml-fop/src/org/apache/fop/render/AbstractRenderer.java     Thu Sep 19 00:26:00 
2002
+++ xml-fop-new/src/org/apache/fop/render/AbstractRenderer.java Fri Nov  1 22:26:22 
+2002
@@ -122,8 +122,7 @@
     public void renderExtension(TreeExt ext) { }
 
     /**
-     * Prepare a page for rendering. This is called if the renderer supports
-     * out of order rendering. The renderer should prepare the page so that a
+     * Prepare a page for rendering. The renderer should prepare the page so that a
      * page further on in the set of pages can be rendered. The body of the
      * page should not be rendered. The page will be rendered at a later time
      * by the call to render page.
diff -u -r xml-fop/src/org/apache/fop/render/Renderer.java 
xml-fop-new/src/org/apache/fop/render/Renderer.java
--- xml-fop/src/org/apache/fop/render/Renderer.java     Mon Sep  9 18:25:37 2002
+++ xml-fop-new/src/org/apache/fop/render/Renderer.java Fri Nov  1 22:26:22 2002
@@ -113,8 +113,7 @@
     void renderExtension(TreeExt ext);
 
     /**
-     * This is called if the renderer supports out of order rendering. The
-     * renderer should prepare the page so that a page further on in the set of
+     * The renderer should prepare the page so that a page further on in the set of
      * pages can be rendered. The body of the page should not be rendered. The
      * page will be rendered at a later time by the call to {@link
      * #renderPage(PageViewport)}.
<?xml version="1.0" encoding="UTF-8"?>
<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format";>

<fo:layout-master-set>
  <fo:simple-page-master page-height="100mm" page-width="210mm" master-name="page">
    <fo:region-body/>
  </fo:simple-page-master>
</fo:layout-master-set>

<fo:page-sequence initial-page-number="1" master-reference="page">
  <fo:flow flow-name="xsl-region-body">

<fo:block><fo:basic-link internal-destination="a">a, page <fo:page-number-citation 
ref-id="a"/></fo:basic-link></fo:block>
<fo:block><fo:basic-link internal-destination="a">a, page <fo:page-number-citation 
ref-id="a"/></fo:basic-link></fo:block>
<fo:block><fo:basic-link internal-destination="a">a, page <fo:page-number-citation 
ref-id="a"/></fo:basic-link></fo:block>
<fo:block><fo:basic-link internal-destination="a">a, page <fo:page-number-citation 
ref-id="a"/></fo:basic-link></fo:block>
<fo:block><fo:basic-link internal-destination="a">a, page <fo:page-number-citation 
ref-id="a"/></fo:basic-link></fo:block>
<fo:block><fo:basic-link internal-destination="a">a, page <fo:page-number-citation 
ref-id="a"/></fo:basic-link></fo:block>
<fo:block><fo:basic-link internal-destination="a">a, page <fo:page-number-citation 
ref-id="a"/></fo:basic-link></fo:block>
<fo:block><fo:basic-link internal-destination="a">a, page <fo:page-number-citation 
ref-id="a"/></fo:basic-link></fo:block>
<fo:block><fo:basic-link internal-destination="a">a, page <fo:page-number-citation 
ref-id="a"/></fo:basic-link></fo:block>
<fo:block><fo:basic-link internal-destination="a">a, page <fo:page-number-citation 
ref-id="a"/></fo:basic-link></fo:block>
<fo:block><fo:basic-link internal-destination="a">a, page <fo:page-number-citation 
ref-id="a"/></fo:basic-link></fo:block>
<fo:block><fo:basic-link internal-destination="a">a, page <fo:page-number-citation 
ref-id="a"/></fo:basic-link></fo:block>
<fo:block><fo:basic-link internal-destination="a">a, page <fo:page-number-citation 
ref-id="a"/></fo:basic-link></fo:block>
<fo:block><fo:basic-link internal-destination="a">a, page <fo:page-number-citation 
ref-id="a"/></fo:basic-link></fo:block>
<fo:block><fo:basic-link internal-destination="a">a, page <fo:page-number-citation 
ref-id="a"/></fo:basic-link></fo:block>
<fo:block><fo:basic-link internal-destination="a">a, page <fo:page-number-citation 
ref-id="a"/></fo:basic-link></fo:block>
<fo:block><fo:basic-link internal-destination="a">a, page <fo:page-number-citation 
ref-id="a"/></fo:basic-link></fo:block>
<fo:block><fo:basic-link internal-destination="a">a, page <fo:page-number-citation 
ref-id="a"/></fo:basic-link></fo:block>
<fo:block><fo:basic-link internal-destination="a">a, page <fo:page-number-citation 
ref-id="a"/></fo:basic-link></fo:block>
<fo:block><fo:basic-link internal-destination="a">a, page <fo:page-number-citation 
ref-id="a"/></fo:basic-link></fo:block>
<fo:block><fo:basic-link internal-destination="a">a, page <fo:page-number-citation 
ref-id="a"/></fo:basic-link></fo:block>
<fo:block><fo:basic-link internal-destination="a">a, page <fo:page-number-citation 
ref-id="a"/></fo:basic-link></fo:block>
<fo:block><fo:basic-link internal-destination="a">a, page <fo:page-number-citation 
ref-id="a"/></fo:basic-link></fo:block>
<fo:block><fo:basic-link internal-destination="a">a, page <fo:page-number-citation 
ref-id="a"/></fo:basic-link></fo:block>
<fo:block><fo:basic-link internal-destination="a">a, page <fo:page-number-citation 
ref-id="a"/></fo:basic-link></fo:block>
<fo:block><fo:basic-link internal-destination="a">a, page <fo:page-number-citation 
ref-id="a"/></fo:basic-link></fo:block>
<fo:block><fo:basic-link internal-destination="a">a, page <fo:page-number-citation 
ref-id="a"/></fo:basic-link></fo:block>
<fo:block><fo:basic-link internal-destination="a">a, page <fo:page-number-citation 
ref-id="a"/></fo:basic-link></fo:block>

<fo:block id="a">a</fo:block>

  </fo:flow>
</fo:page-sequence>
</fo:root>

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]

Reply via email to