You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xmlgraphics.apache.org by jg...@apache.org on 2026/05/19 16:42:34 UTC

(xmlgraphics-fop) branch main updated: FOP-3316 Fix reading order when using the static-region-per-page conf

This is an automated email from the ASF dual-hosted git repository.

joao12021996 pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/xmlgraphics-fop.git


The following commit(s) were added to refs/heads/main by this push:
     new 32930c75a FOP-3316 Fix reading order when using the static-region-per-page conf
32930c75a is described below

commit 32930c75a080ec1f5bb7ab46c821093f43089d86
Author: Joao Goncalves <an...@gmail.com>
AuthorDate: Fri May 15 13:39:34 2026 -0500

    FOP-3316 Fix reading order when using the static-region-per-page conf
---
 .../layoutmgr/table/TableContentLayoutManager.java |   5 +-
 .../fop/render/pdf/PDFStructureTreeBuilder.java    |  11 +-
 .../fop/render/pdf/PDFStructureTreeTestCase.java   | 205 +++++++++++++--------
 fop/test/fo/reading_order.fo                       |  30 +++
 .../fo/reading_order_block_spanned_over_page.fo    |  30 +++
 fop/test/fo/reading_order_table_in_body.fo         |  63 +++++++
 fop/test/fo/reading_order_table_in_header.fo       |  53 ++++++
 7 files changed, 304 insertions(+), 93 deletions(-)

diff --git a/fop-core/src/main/java/org/apache/fop/layoutmgr/table/TableContentLayoutManager.java b/fop-core/src/main/java/org/apache/fop/layoutmgr/table/TableContentLayoutManager.java
index 053ce737a..851f6c46a 100644
--- a/fop-core/src/main/java/org/apache/fop/layoutmgr/table/TableContentLayoutManager.java
+++ b/fop-core/src/main/java/org/apache/fop/layoutmgr/table/TableContentLayoutManager.java
@@ -465,7 +465,7 @@ public class TableContentLayoutManager implements PercentBaseContext {
             addHeaderFooterAreas(headerElements, tableLM.getTable().getTableHeader(), painter,
                     false);
             if (!ancestorTreatAsArtifact) {
-                headerIsBeingRepeated = true;
+                headerIsBeingRepeated = !tableLM.getFObj().getUserAgent().isStaticRegionsPerPageForAccessibility();
             }
             layoutContext.setTreatAsArtifact(ancestorTreatAsArtifact);
         }
@@ -487,7 +487,8 @@ public class TableContentLayoutManager implements PercentBaseContext {
 
         if (footerElements != null && !footerElements.isEmpty()) {
             boolean ancestorTreatAsArtifact = layoutContext.treatAsArtifact();
-            layoutContext.setTreatAsArtifact(treatFooterAsArtifact);
+            layoutContext.setTreatAsArtifact(treatFooterAsArtifact
+                    && !tableLM.getFObj().getUserAgent().isStaticRegionsPerPageForAccessibility());
             //Positions for footers are simply added at the end
             addHeaderFooterAreas(footerElements, tableLM.getTable().getTableFooter(), painter, true);
             if (lastPos instanceof TableHFPenaltyPosition && !tableLM.getFooterFootnotes().isEmpty()) {
diff --git a/fop-core/src/main/java/org/apache/fop/render/pdf/PDFStructureTreeBuilder.java b/fop-core/src/main/java/org/apache/fop/render/pdf/PDFStructureTreeBuilder.java
index b755cfe29..7b673a2f8 100644
--- a/fop-core/src/main/java/org/apache/fop/render/pdf/PDFStructureTreeBuilder.java
+++ b/fop-core/src/main/java/org/apache/fop/render/pdf/PDFStructureTreeBuilder.java
@@ -355,8 +355,6 @@ public class PDFStructureTreeBuilder implements StructureTreeEventHandler {
 
     private PDFStructElem rootStructureElement;
 
-    private boolean staticContent;
-
     void setPdfFactory(PDFFactory pdfFactory) {
         this.pdfFactory = pdfFactory;
     }
@@ -403,9 +401,6 @@ public class PDFStructureTreeBuilder implements StructureTreeEventHandler {
     }
 
     public StructureTreeElement startNode(String name, Attributes attributes, StructureTreeElement parent) {
-        if ("static-content".equals(name)) {
-            staticContent = true;
-        }
         if (!isPDFA1Safe(name)) {
             return null;
         }
@@ -416,7 +411,7 @@ public class PDFStructureTreeBuilder implements StructureTreeEventHandler {
             parentElem = parent;
         }
         StructureTreeElement structElem;
-        if (staticContent && pdfFactory.getDocument().isStaticRegionsPerPageForAccessibility()) {
+        if (pdfFactory.getDocument().isStaticRegionsPerPageForAccessibility()) {
             structElem = new Factory(name, parentElem, attributes);
         } else {
             structElem = createStructureElement(
@@ -464,10 +459,6 @@ public class PDFStructureTreeBuilder implements StructureTreeEventHandler {
     }
 
     public void endNode(String name) {
-        if ("static-content".equals(name)) {
-            staticContent = false;
-        }
-
         if (isPDFA1Safe(name)) {
             ancestors.removeFirst();
         }
diff --git a/fop-core/src/test/java/org/apache/fop/render/pdf/PDFStructureTreeTestCase.java b/fop-core/src/test/java/org/apache/fop/render/pdf/PDFStructureTreeTestCase.java
index 938c81379..718a1ef4a 100644
--- a/fop-core/src/test/java/org/apache/fop/render/pdf/PDFStructureTreeTestCase.java
+++ b/fop-core/src/test/java/org/apache/fop/render/pdf/PDFStructureTreeTestCase.java
@@ -21,6 +21,9 @@ package org.apache.fop.render.pdf;
 import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
 import java.io.File;
+import java.io.FileInputStream;
+import java.io.InputStream;
+import java.util.Arrays;
 import java.util.Collection;
 import java.util.List;
 
@@ -35,12 +38,26 @@ import org.junit.Test;
 import org.xml.sax.helpers.AttributesImpl;
 import static org.junit.Assert.assertEquals;
 
+import org.apache.fop.accessibility.StructureTreeElement;
 import org.apache.fop.apps.FOUserAgent;
 import org.apache.fop.apps.Fop;
 import org.apache.fop.apps.FopFactory;
 import org.apache.fop.pdf.PDFLinearizationTestCase;
 import org.apache.fop.pdf.PDFStructElem;
 import org.apache.fop.pdf.StandardStructureTypes;
+import org.apache.fop.pdf.StructureType;
+import static org.apache.fop.pdf.StandardStructureTypes.Grouping.DIV;
+import static org.apache.fop.pdf.StandardStructureTypes.Grouping.DOCUMENT;
+import static org.apache.fop.pdf.StandardStructureTypes.Grouping.PART;
+import static org.apache.fop.pdf.StandardStructureTypes.Grouping.SECT;
+import static org.apache.fop.pdf.StandardStructureTypes.Paragraphlike.P;
+import static org.apache.fop.pdf.StandardStructureTypes.Table.TABLE;
+import static org.apache.fop.pdf.StandardStructureTypes.Table.TBODY;
+import static org.apache.fop.pdf.StandardStructureTypes.Table.TD;
+import static org.apache.fop.pdf.StandardStructureTypes.Table.TFOOT;
+import static org.apache.fop.pdf.StandardStructureTypes.Table.TH;
+import static org.apache.fop.pdf.StandardStructureTypes.Table.THEAD;
+import static org.apache.fop.pdf.StandardStructureTypes.Table.TR;
 
 public class PDFStructureTreeTestCase {
     @Test
@@ -77,111 +94,137 @@ public class PDFStructureTreeTestCase {
     }
 
     @Test
-    public void testTableHeaderDuplicatedIfStaticRegionsPerPageTrue() throws Exception {
-        List<PDFStructElem> elems = getPDFStructElems("<fo:root xmlns:fo=\"http://www.w3.org/1999/XSL/Format\" "
-                + "font-family=\"arial\" font-size=\"16pt\" xml:lang=\"en\">\n"
-                + "  <fo:layout-master-set>\n"
-                + "    <fo:simple-page-master master-name=\"A5-Page\" page-width=\"148mm\" page-height=\"210mm\">\n"
-                + "      <fo:region-body background-color=\"#efefef\" margin=\"10mm\"/>\n"
-                + "    </fo:simple-page-master>\n"
-                + "    <fo:page-sequence-master master-name=\"A5\">\n"
-                + "      <fo:repeatable-page-master-alternatives>\n"
-                + "        <fo:conditional-page-master-reference master-reference=\"A5-Page\"/>\n"
-                + "      </fo:repeatable-page-master-alternatives>\n"
-                + "    </fo:page-sequence-master>\n"
-                + "  </fo:layout-master-set>\n"
-                + "  <fo:page-sequence master-reference=\"A5\">\n"
-                + "    <fo:flow flow-name=\"xsl-region-body\">\n"
-                + "      <fo:block>\n"
-                + "        <fo:block padding-bottom=\"160mm\">Table overflow</fo:block>\n"
-                + "        <fo:table table-layout=\"fixed\" width=\"100%\">\n"
-                + "          <fo:table-header>\n"
-                + "            <fo:table-row>\n"
-                + "              <fo:table-cell number-columns-spanned=\"2\">\n"
-                + "                <fo:block font-weight=\"bold\" font-style=\"italic\" text-align=\"left\" "
-                + "text-align-last=\"center\"> Table Title </fo:block>\n"
-                + "              </fo:table-cell>\n"
-                + "            </fo:table-row>\n"
-                + "          </fo:table-header>\n"
-                + "          <fo:table-body>\n"
-                + "            <fo:table-row>\n"
-                + "              <fo:table-cell>\n"
-                + "                <fo:block>Row 1 Column A</fo:block>\n"
-                + "              </fo:table-cell>\n"
-                + "              <fo:table-cell>\n"
-                + "                <fo:block>Row 1 Column B</fo:block>\n"
-                + "              </fo:table-cell>\n"
-                + "            </fo:table-row>\n"
-                + "            <fo:table-row>\n"
-                + "              <fo:table-cell>\n"
-                + "                <fo:block>Row 2 Column A</fo:block>\n"
-                + "              </fo:table-cell>\n"
-                + "              <fo:table-cell>\n"
-                + "                <fo:block>Row 2 Column B</fo:block>\n"
-                + "              </fo:table-cell>\n"
-                + "            </fo:table-row>\n"
-                + "            <fo:table-row>\n"
-                + "              <fo:table-cell>\n"
-                + "                <fo:block>Row 2 Column A</fo:block>\n"
-                + "              </fo:table-cell>\n"
-                + "              <fo:table-cell>\n"
-                + "                <fo:block>Row 2 Column B</fo:block>\n"
-                + "              </fo:table-cell>\n"
-                + "            </fo:table-row>\n"
-                + "            <fo:table-row>\n"
-                + "              <fo:table-cell>\n"
-                + "                <fo:block>Row 2 Column A</fo:block>\n"
-                + "              </fo:table-cell>\n"
-                + "              <fo:table-cell>\n"
-                + "                <fo:block>Row 2 Column B</fo:block>\n"
-                + "              </fo:table-cell>\n"
-                + "            </fo:table-row>\n"
-                + "          </fo:table-body>\n"
-                + "        </fo:table>\n"
-                + "      </fo:block>\n"
-                + "    </fo:flow>\n"
-                + "  </fo:page-sequence>\n"
-                + "</fo:root>");
+    public void testReadingOrder() throws Exception {
+        checkReadingOrder(Arrays.asList(DOCUMENT, PART, SECT, DIV, P, P, DIV, P, DIV, P, P, DIV, P),
+                "test/fo/reading_order.fo");
+    }
 
+    @Test
+    public void testReadingOrderWithTableInHeader() throws Exception {
+        checkReadingOrder(Arrays.asList(DOCUMENT, PART, SECT, DIV, P, TABLE, THEAD, TR, TH, P, TBODY, TR, TD, P, TFOOT,
+                        TR, TD, P, P, DIV, P, DIV, P, TABLE, THEAD, TR, TH, P, TBODY, TR, TD, P, TFOOT,
+                        TR, TD, P, P, DIV, P),
+                "test/fo/reading_order_table_in_header.fo");
+    }
+
+    @Test
+    public void testReadingOrderBlockSpannedOverPage() throws Exception {
+        checkReadingOrder(Arrays.asList(DOCUMENT, PART, SECT, DIV, P, P, DIV, P, DIV, P, P, DIV, P, DIV, P, P, DIV, P),
+                "test/fo/reading_order_block_spanned_over_page.fo");
+    }
+
+    @Test
+    public void testReadingOrderTableInBody() throws Exception {
+        checkReadingOrder(Arrays.asList(DOCUMENT, PART, SECT, DIV, P, P, TABLE, THEAD, TR, TH, P, TBODY, TR, TD, P, TD,
+                        P, TFOOT, TR, TD, P, DIV, P, DIV, P, P, TABLE, THEAD, TR, TH, P, TBODY, TR, TD, P, TD, P, TFOOT,
+                        TR, TD, P, DIV, P),
+                "test/fo/reading_order_table_in_body.fo");
+    }
+
+    private void checkReadingOrder(List<StructureType> orderedTypes,  String filePath) throws Exception {
+        List<PDFStructElem> elems = getPDFStructElems(filePath, true);
+
+        int index = 0;
+        for (PDFStructElem elem : elems) {
+            assertEquals("Reading order must be preserved when static-region-per-page is true",
+                    orderedTypes.get(index), elem.getStructureType());
+            index++;
+        }
+
+        assertEquals("Must verify all the PDFStructElements", orderedTypes.size(), elems.size());
+    }
+
+    @Test
+    public void testTableDuplicatedIfStaticRegionsPerPageTrue() throws Exception {
+        checkTableBodyCount(true, "test/fo/reading_order_table_in_body.fo",
+                "A table element should only have one respective structure element", 2);
+    }
+
+    @Test
+    public void testTableBodyNotDuplicatedIfStaticRegionsPerPageFalse() throws Exception {
+        checkTableBodyCount(false, "test/fo/reading_order_table_in_body.fo",
+                "A table element should only have one respective structure element", 1);
+    }
+
+    @Test
+    public void testTableBodyDuplicatedIfInsideStaticContent() throws Exception {
+        checkTableBodyCount(true, "test/fo/reading_order_table_in_header.fo",
+                "If the conf is set to true, a table element must be duplicated like any other fo element", 2);
+    }
+
+    private void checkTableBodyCount(boolean staticRegionPerPage, String filePath, String assertionMessage,
+                                     int expectedCount) throws Exception {
+        List<PDFStructElem> elems = getPDFStructElems(filePath, staticRegionPerPage);
+
+        int count = countTableElements(elems, TABLE);
+        assertEquals(assertionMessage, expectedCount, count);
+
+        count = countTableElements(elems, StandardStructureTypes.Table.TBODY);
+        assertEquals(assertionMessage, expectedCount, count);
+
+        count = countTableElements(elems, THEAD);
+        assertEquals(assertionMessage, expectedCount, count);
+
+        count = countTableElements(elems, StandardStructureTypes.Table.TFOOT);
+        assertEquals(assertionMessage, expectedCount, count);
+    }
+
+    private int countTableElements(List<PDFStructElem> elems, StructureType elementType) {
         int count = 0;
         for (PDFStructElem elem : elems) {
-            if (elem.getStructureType().equals(StandardStructureTypes.Table.THEAD)) {
+            if (elem.getStructureType().equals(elementType)) {
                 count++;
             }
         }
 
-        assertEquals("The static region per page conf must apply to static regions only", 1, count);
+        return count;
     }
 
-    private List<PDFStructElem> getPDFStructElems(String fo) throws Exception {
-        FopFactory fopFactory = getFopFactory();
-        FOUserAgent userAgent = fopFactory.newFOUserAgent();
-        foToOutput(fo, fopFactory, userAgent);
+    private List<PDFStructElem> getPDFStructElems(String foFileName, boolean staticRegionPerPage) throws Exception {
+        FopFactory fopFactory = getFopFactory(staticRegionPerPage, true);
+            FOUserAgent userAgent = fopFactory.newFOUserAgent();
+        foToOutput(new FileInputStream(foFileName), fopFactory, userAgent);
+
+        StructureTreeElement block = userAgent.getStructureTreeEventHandler()
+                .startNode("#PCDATA", new AttributesImpl(), null);
 
-        PDFStructElem block = (PDFStructElem) userAgent
-                .getStructureTreeEventHandler().startNode("block", new AttributesImpl(), null);
+        PDFStructElem blockElem;
+        if (block instanceof PDFStructElem) {
+            blockElem = (PDFStructElem) block;
+        } else {
+            blockElem = ((PDFStructureTreeBuilder.Factory) block).createStructureElement(1);
+        }
 
-        return block.getDocument().getStructureTreeElements();
+        return blockElem.getDocument().getStructureTreeElements();
     }
 
     private ByteArrayOutputStream foToOutput(String fo) throws Exception {
-        FopFactory fopFactory = getFopFactory();
-        return foToOutput(fo, fopFactory, fopFactory.newFOUserAgent());
+        FopFactory fopFactory = getFopFactory(true, false);
+        return foToOutput(new ByteArrayInputStream(fo.getBytes()), fopFactory, fopFactory.newFOUserAgent());
     }
 
-    private ByteArrayOutputStream foToOutput(String fo, FopFactory fopFactory, FOUserAgent userAgent) throws Exception {
+
+    private ByteArrayOutputStream foToOutput(InputStream inputStream, FopFactory fopFactory, FOUserAgent userAgent)
+            throws Exception {
         ByteArrayOutputStream bos = new ByteArrayOutputStream();
         Fop fop = fopFactory.newFop("application/pdf", userAgent, bos);
         Transformer transformer = TransformerFactory.newInstance().newTransformer();
-        Source src = new StreamSource(new ByteArrayInputStream(fo.getBytes()));
+
+        Source src = new StreamSource(inputStream);
         Result res = new SAXResult(fop.getDefaultHandler());
         transformer.transform(src, res);
         return bos;
     }
 
-    private FopFactory getFopFactory() throws Exception {
-        String fopxconf =
-                "<fop version=\"1.0\"><accessibility static-region-per-page=\"true\">true</accessibility></fop>";
+    private FopFactory getFopFactory(boolean staticRegionPerPage, boolean useObjectsStreams) throws Exception {
+        String fopxconf = "<fop version=\"1.0\">"
+                + "     <accessibility static-region-per-page=\"" + staticRegionPerPage + "\">true</accessibility>"
+                + "         <renderers>\n"
+                + "             <renderer mime=\"application/pdf\">\n"
+                + "                   <use-object-streams>" + useObjectsStreams + "</use-object-streams>"
+                + "             </renderer>\n"
+                + "         </renderers>\n"
+                + "</fop>";
         return FopFactory.newInstance(new File(".").toURI(), new ByteArrayInputStream(fopxconf.getBytes()));
     }
 }
diff --git a/fop/test/fo/reading_order.fo b/fop/test/fo/reading_order.fo
new file mode 100644
index 000000000..aa04d0798
--- /dev/null
+++ b/fop/test/fo/reading_order.fo
@@ -0,0 +1,30 @@
+<?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 master-name="Pages" page-height="297mm" page-width="210mm">
+            <fo:region-body region-name="Body"/>
+            <fo:region-before region-name="Header" extent="70mm"/>
+            <fo:region-after region-name="Footer" extent="27mm"/>
+        </fo:simple-page-master>
+    </fo:layout-master-set>
+    <fo:page-sequence format="1" id="th_default_sequence1" master-reference="Pages">
+        <fo:static-content flow-name="Header">
+            <fo:block-container height="27mm" width="68mm" top="5mm" left="14.5mm" absolute-position="fixed">
+                <fo:block margin-top="5mm">
+                    rest header
+                </fo:block>
+            </fo:block-container>
+        </fo:static-content>
+        <fo:static-content flow-name="Footer">
+            <fo:block-container height="27mm" width="68mm" top="100mm" left="14.5mm" absolute-position="fixed">
+                <fo:block margin-top="5mm">
+                    rest footer
+                </fo:block>
+            </fo:block-container>
+        </fo:static-content>
+        <fo:flow flow-name="Body">
+            <fo:block padding-bottom="27cm" page-break-after="always">test</fo:block>
+            <fo:block padding-bottom="27cm" page-break-after="always">test1</fo:block>
+        </fo:flow>
+    </fo:page-sequence>
+</fo:root>
\ No newline at end of file
diff --git a/fop/test/fo/reading_order_block_spanned_over_page.fo b/fop/test/fo/reading_order_block_spanned_over_page.fo
new file mode 100644
index 000000000..88abe1909
--- /dev/null
+++ b/fop/test/fo/reading_order_block_spanned_over_page.fo
@@ -0,0 +1,30 @@
+<?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 master-name="Pages" page-height="297mm" page-width="210mm">
+            <fo:region-body region-name="Body"/>
+            <fo:region-before region-name="Header" extent="70mm"/>
+            <fo:region-after region-name="Footer" extent="27mm"/>
+        </fo:simple-page-master>
+    </fo:layout-master-set>
+    <fo:page-sequence format="1" id="th_default_sequence1" master-reference="Pages">
+        <fo:static-content flow-name="Header">
+            <fo:block-container height="27mm" width="68mm" top="5mm" left="14.5mm" absolute-position="fixed">
+                <fo:block margin-top="5mm">
+                    rest header
+                </fo:block>
+            </fo:block-container>
+        </fo:static-content>
+        <fo:static-content flow-name="Footer">
+            <fo:block-container height="27mm" width="68mm" top="100mm" left="14.5mm" absolute-position="fixed">
+                <fo:block margin-top="5mm">
+                    rest footer
+                </fo:block>
+            </fo:block-container>
+        </fo:static-content>
+        <fo:flow flow-name="Body">
+            <fo:block padding-bottom="27cm">test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test tes [...]
+            <fo:block padding-bottom="27cm" page-break-after="always">test1</fo:block>
+        </fo:flow>
+    </fo:page-sequence>
+</fo:root>
\ No newline at end of file
diff --git a/fop/test/fo/reading_order_table_in_body.fo b/fop/test/fo/reading_order_table_in_body.fo
new file mode 100644
index 000000000..65b82b80d
--- /dev/null
+++ b/fop/test/fo/reading_order_table_in_body.fo
@@ -0,0 +1,63 @@
+<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format" font-family="Dina" font-size="16pt" xml:lang="en">
+    <fo:layout-master-set>
+        <fo:simple-page-master master-name="Pages" page-height="148mm" page-width="210mm">
+            <fo:region-body region-name="Body" margin-top="80mm" margin-bottom="45mm"/>
+            <fo:region-before region-name="Header" extent="70mm"/>
+            <fo:region-after region-name="Footer" extent="27mm"/>
+        </fo:simple-page-master>
+    </fo:layout-master-set>
+    <fo:page-sequence master-reference="Pages">
+        <fo:static-content flow-name="Header">
+            <fo:block-container height="27mm" width="68mm" top="5mm" left="14.5mm" absolute-position="fixed">
+                <fo:block margin-top="5mm">
+                    rest header
+                </fo:block>
+            </fo:block-container>
+        </fo:static-content>
+        <fo:static-content flow-name="Footer">
+            <fo:block-container height="27mm" width="68mm" top="110mm" left="14.5mm" absolute-position="fixed">
+                <fo:block margin-top="5mm">
+                    rest footer
+                </fo:block>
+            </fo:block-container>
+        </fo:static-content>
+        <fo:flow flow-name="Body">
+            <fo:block>
+                <fo:table table-layout="fixed" width="100%">
+                    <fo:table-header>
+                        <fo:table-row>
+                            <fo:table-cell number-columns-spanned="2">
+                                <fo:block text-align="left" text-align-last="center"> Table Title </fo:block>
+                            </fo:table-cell>
+                        </fo:table-row>
+                    </fo:table-header>
+                    <fo:table-footer>
+                        <fo:table-row>
+                            <fo:table-cell number-columns-spanned="2">
+                                <fo:block text-align="left" text-align-last="center"> Table footer </fo:block>
+                            </fo:table-cell>
+                        </fo:table-row>
+                    </fo:table-footer>
+                    <fo:table-body>
+                        <fo:table-row>
+                            <fo:table-cell>
+                                <fo:block>Row 1 Column A</fo:block>
+                            </fo:table-cell>
+                            <fo:table-cell>
+                                <fo:block>Row 1 Column B</fo:block>
+                            </fo:table-cell>
+                        </fo:table-row>
+                        <fo:table-row>
+                            <fo:table-cell>
+                                <fo:block>Row 2 Column A</fo:block>
+                            </fo:table-cell>
+                            <fo:table-cell>
+                                <fo:block>Row 2 Column B</fo:block>
+                            </fo:table-cell>
+                        </fo:table-row>
+                    </fo:table-body>
+                </fo:table>
+            </fo:block>
+        </fo:flow>
+    </fo:page-sequence>
+</fo:root>
\ No newline at end of file
diff --git a/fop/test/fo/reading_order_table_in_header.fo b/fop/test/fo/reading_order_table_in_header.fo
new file mode 100644
index 000000000..694b127ab
--- /dev/null
+++ b/fop/test/fo/reading_order_table_in_header.fo
@@ -0,0 +1,53 @@
+<?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 master-name="Pages" page-height="297mm" page-width="210mm">
+            <fo:region-body region-name="Body"/>
+            <fo:region-before region-name="Header" extent="70mm"/>
+            <fo:region-after region-name="Footer" extent="27mm"/>
+        </fo:simple-page-master>
+    </fo:layout-master-set>
+	<fo:page-sequence format="1" id="th_default_sequence1" master-reference="Pages">
+		<fo:static-content flow-name="Header">
+			<fo:block-container height="27mm" width="68mm" top="5mm" left="14.5mm" absolute-position="fixed">
+				<fo:block margin-top="5mm">
+                    rest header
+					<fo:table>
+                        <fo:table-header>
+                            <fo:table-row>
+                                <fo:table-cell>
+                                    <fo:block>table header</fo:block>
+                                </fo:table-cell>
+                            </fo:table-row>
+                        </fo:table-header>
+                        <fo:table-footer>
+                            <fo:table-row>
+                                <fo:table-cell>
+                                    <fo:block>table footer</fo:block>
+                                </fo:table-cell>
+                            </fo:table-row>
+                        </fo:table-footer>
+                        <fo:table-body>
+                            <fo:table-row>
+                                <fo:table-cell>
+                                    <fo:block>table body</fo:block>
+                                </fo:table-cell>
+                            </fo:table-row>
+                        </fo:table-body>
+                    </fo:table>
+				</fo:block>
+			</fo:block-container>
+		</fo:static-content>
+		<fo:static-content flow-name="Footer">
+			<fo:block-container height="27mm" width="68mm" top="100mm" left="14.5mm" absolute-position="fixed">
+				<fo:block margin-top="5mm">
+					rest footer
+				</fo:block>
+			</fo:block-container>
+		</fo:static-content>
+		<fo:flow flow-name="Body">
+			<fo:block padding-bottom="27cm" page-break-after="always">test</fo:block>
+			<fo:block padding-bottom="27cm" page-break-after="always">test1</fo:block>
+		</fo:flow>
+	</fo:page-sequence>
+</fo:root>
\ No newline at end of file


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: commits-help@xmlgraphics.apache.org