Uploaded image for project: 'XWiki Platform'
  1. XWiki Platform
  2. XWIKI-20728

Tables with rowspan get mangled during PDF export if PDF header/footer is enabled

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • Major
    • None
    • 15.1
    • Export - PDF
    • None
    • Ubuntu 20.04.5 LTS
      xwiki-tomcat9-pgsql
    • Unknown

    Description

      Background:

      I have been experiencing lots of issues with exporting PDFs of pages containing tables, and this has made the PDF export feature almost impossible to use in some cases.  After experimenting a little, I have created two example tables in XWiki that I can use to reproduce my issues with the PDF exporter.  In both tables, I have a 3-tiered table that has portions of the first two columns grouped using rowspan.  The source code for both tables is listed at the bottom of this issue.  Table 1 is identical to Table 2 except for the fact that Table 2 has a cell with a long text string in Column 3 that occurs at a PDF page transition.

      Expected Behavior:

      If I export either table to PDF using the Default Template and without any Export Options enabled:

      • Table 1 gives me a 3-page PDF as my output. 
      • Table 2 gives me a 4-page PDF as my output.
      • There are no unexpected changes in the formatting.
      • I would expect the output to be basically the same if I was to enable the Header or Footer options during the PDF export.

      Actual Behavior:

      If I enable the Header or Footer option in the Export Options then I get really bizarre output:

      • The Table 1 export generates a 28-page PDF with chunks of the table repeated within the PDF.
      • The Table 2 export generates a 5-page PDF, and, as expected, the Column 3 cell containing the long string spills into the next page at the page transition.  (At the transition from PDF Page 2 to Page 3.)  However, when this happens, the second page seems to lose track of the column count and only displays Column 3 until it reaches the end of the current rowspan.  This makes it look like the Column 3 data is actually in Column 1.
      • For both tables, the first page of the PDF just displays the first row of the table and the rest of the page is blank.

      Attachments:

      Attached to this issue are the exported PDFs for both tables.  Each table has a PDF exported with and without the Header/Footer options enabled.

      Table Source Code:

      Table 1:

       

      |=Group|=Subgroup|=Item
      |(% colspan="1" rowspan="40" %)Group 1|(% colspan="1" rowspan="20" %)Subgroup 1|Item 1
      |Item 2
      |Item 3
      |Item 4
      |Item 5
      |Item 6
      |Item 7
      |Item 8
      |Item 9
      |Item 10
      |Item 11
      |Item 12
      |Item 13
      |Item 14
      |Item 15
      |Item 16
      |Item 17
      |Item 18
      |Item 19
      |Item 20
      |(% colspan="1" rowspan="20" %)Subgroup 2|Item 1
      |Item 2
      |Item 3
      |Item 4
      |Item 5
      |Item 6
      |Item 7
      |Item 8
      |Item 9
      |Item 10
      |Item 11
      |Item 12
      |Item 13
      |Item 14
      |Item 15
      |Item 16
      |Item 17
      |Item 18
      |Item 19
      |Item 20
      |(% colspan="1" rowspan="40" %)Group 2|(% colspan="1" rowspan="20" %)Subgroup 1|Item 1
      |Item 2
      |Item 3
      |Item 4
      |Item 5
      |Item 6
      |Item 7
      |Item 8
      |Item 9
      |Item 10
      |Item 11
      |Item 12
      |Item 13
      |Item 14
      |Item 15
      |Item 16
      |Item 17
      |Item 18
      |Item 19
      |Item 20
      |(% colspan="1" rowspan="20" %)Subgroup 2|Item 1
      |Item 2
      |Item 3
      |Item 4
      |Item 5
      |Item 6
      |Item 7
      |Item 8
      |Item 9
      |Item 10
      |Item 11
      |Item 12
      |Item 13
      |Item 14
      |Item 15
      |Item 16
      |Item 17
      |Item 18
      |Item 19
      |Item 20  

      Table 2:

       

       

      |=Group|=Subgroup|=Item
      |(% colspan="1" rowspan="40" %)Group 1|(% colspan="1" rowspan="20" %)Subgroup 1|Item 1
      |Item 2
      |Item 3
      |Item 4
      |Item 5
      |Item 6
      |Item 7
      |Item 8
      |Item 9
      |Item 10
      |Item 11
      |Item 12
      |Item 13
      |Item 14
      |Item 15
      |Item 16
      |Item 17
      |Item 18
      |Item 19
      |Item 20
      |(% colspan="1" rowspan="20" %)Subgroup 2|Item 1
      |Item 2
      |Item 3
      |Item 4
      |Item 5
      |Item 6
      |Item 7 is really long.  Item 7 is really long.  Item 7 is really long.  Item 7 is really long.  Item 7 is really long.  Item 7 is really long.  Item 7 is really long.  Item 7 is really long.  Item 7 is really long.  Item 7 is really long.  Item 7 is really long.  Item 7 is really long.
      |Item 8
      |Item 9
      |Item 10
      |Item 11
      |Item 12
      |Item 13
      |Item 14
      |Item 15
      |Item 16
      |Item 17
      |Item 18
      |Item 19
      |Item 20
      |(% colspan="1" rowspan="40" %)Group 2|(% colspan="1" rowspan="20" %)Subgroup 1|Item 1
      |Item 2
      |Item 3
      |Item 4
      |Item 5
      |Item 6
      |Item 7
      |Item 8
      |Item 9
      |Item 10
      |Item 11
      |Item 12
      |Item 13
      |Item 14
      |Item 15
      |Item 16
      |Item 17
      |Item 18
      |Item 19
      |Item 20
      |(% colspan="1" rowspan="20" %)Subgroup 2|Item 1
      |Item 2
      |Item 3
      |Item 4
      |Item 5
      |Item 6
      |Item 7
      |Item 8
      |Item 9
      |Item 10
      |Item 11
      |Item 12
      |Item 13
      |Item 14
      |Item 15
      |Item 16
      |Item 17
      |Item 18
      |Item 19
      |Item 20  

       

       

      Attachments

        1. table1_with_header_footer.pdf
          57 kB
          spaceman
        2. table1_with_no_options.pdf
          29 kB
          spaceman
        3. table2_with_header_footer.pdf
          34 kB
          spaceman
        4. table2_with_no_options.pdf
          33 kB
          spaceman

        Issue Links

          Activity

            People

              Unassigned Unassigned
              spaceman spaceman
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated: