Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-70093

PDF dataformat export is misformatted when a cell height is greater than a page height

    XMLWordPrintable

Details

    • MOODLE_310_STABLE, MOODLE_311_STABLE, MOODLE_39_STABLE, MOODLE_400_STABLE
    • MOODLE_39_STABLE
    • MOODLE_39_MDL-70093
    • MDL-70093-master
    • Hide
      1. Login as an admin.
      2. Create a course.
      3. Add a Forum activity.
      4. Add a few posts with various text length.
      5. Select Export from the Actions menu.
      6. Select Portable document format (PDF) in the Format dropdown.
      7. Press Export.
      8. Confirm, that rows in the PDF file have expected height.
      9. Confirm, that cells' text not overlapping.
      Show
      Login as an admin. Create a course. Add a Forum activity. Add a few posts with various text length. Select Export from the Actions menu. Select Portable document format (PDF) in the Format dropdown. Press Export. Confirm , that rows in the PDF file have expected height. Confirm , that cells' text not overlapping.

    Description

      When writing a row PDF dataformat calculates the height here:

      https://github.com/moodle/moodle/blob/58ba94a7290940391d1581e591a64fc7e6bb410a/dataformat/pdf/classes/writer.php#L140

      It fails when some cell is big enough to go to the next page, as `$pdf2->getY()` returns Y for the current (read `last`) page, but not the cell height.

      Screenshot:

      There are not many places in the moodle core that use pdf dataformat, so in order to provide this screenshot I put

      return "The user with id '$this->userid' viewed the log report for the course with id '$this->courseid'. Lorem ipsum dolor sit amet, vim ei impetus referrentur definitiones, duo ei quem repudiare dissentiunt. Duo ad choro volutpat quaerendum, erat posse alienum per ne. Nulla ceteros definitionem ne has, an ubique voluptatibus eum. Sea ei simul soluta signiferumque, has no illud atqui oportere. Saperet detraxit mnesarchum eos eu. Ea tempor corpora epicurei eam, ea modo sint reprehendunt sea, usu ex dicam impetus.";
      

      here: https://github.com/moodle/moodle/blob/58ba94a7290940391d1581e591a64fc7e6bb410a/report/log/classes/event/report_viewed.php#L73

       

      Update: This can be easily replicated using Forum export (see testing instruction).

      Attachments

        1. MDL-70093.jpg
          MDL-70093.jpg
          145 kB
        2. pdf_page_break_overlap.png
          pdf_page_break_overlap.png
          57 kB
        3. pdf not overlapping.png
          pdf not overlapping.png
          84 kB
        4. Screenshot_1.jpg
          Screenshot_1.jpg
          69 kB
        5. Screenshot_2.jpg
          Screenshot_2.jpg
          42 kB

        Issue Links

          Activity

            People

              mikhailgolenkov Misha Golenkov
              mikhailgolenkov Misha Golenkov
              Simey Lameze Simey Lameze
              Jake Dallimore Jake Dallimore
              Janelle Barcega Janelle Barcega
              David Woloszyn, Huong Nguyen, Jake Dallimore, Meirza, Michael Hawkins, Raquel Ortega, Safat Shahin, Stevani Andolo
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:
                9/Nov/20

                Time Tracking

                  Estimated:
                  Original Estimate - 0 minutes
                  0m
                  Remaining:
                  Remaining Estimate - 0 minutes
                  0m
                  Logged:
                  Time Spent - 3 hours, 24 minutes
                  3h 24m