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

Layers missing from PDFs in grading view

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Open
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: 3.4.6
    • Fix Version/s: None
    • Component/s: Assignment
    • Labels:
      None
    • Affected Branches:
      MOODLE_34_STABLE

      Description

      When grading an assignment submitted as a PDF, some layers of the PDF may be missing.

      SETUP (Create a course where you are both instructor and student):

      1. Navigate to a course.
      2. Navigate to the Participants list.
      3. Enrol yourself as both a teacher or admin (so that you can edit the course) and as a student (so that you can submit assignments). Save.
      4. Go back to the course page and turn editing on.
      5. Add an activity or resource: Assignment
      6. Set the following, then Save & Display:
      • General/Assignment name: (arbitrary)
      • Submission types/Submission types: File submissions
      • Submission settings/Attempts reopened: Manually
      • Submission settings/Maximum attempts: Unlimited

      STEPS TO REPRODUCE (submit attached file, and grade it):

      1. In the file-submission assignment you created...
      2. Click "Add submission"
      3. Drag and drop the attached file "sample.pdf"
      4. Click "Save Changes" to return to the assignment main page.
      5. Click "View all submissions"
      6. You should see your own submission, with status "Submitted for grading", or "Draft (not submitted)". Click "Grade" beside your submission.
      7. In the default layout, wait until you see an image of the pdf submitted where you can add annotations.

      EXPECTED:
      This view should match the submitted pdf, as seen when you download the pdf by clicking the 'sample.pdf' filename link in the grade panel on the right.

      ACTUAL RESULT:
      The grading view does not show the parts of the pdf. Namely, the coloured annotations are missing. When downloaded and viewed in the browser or a system viewer, all layers of the pdf are visible (indicating that the pdf is stored correctly by Moodle).

      The most alarming part of this is that there is no error message, and the file may appear to be complete, even though significant content is missing.

      INVESTIGATION

      The annotations in the attached file were added using "PDF Expert", though other tools have been reported by our users to give similar results. I have seen the error with both pdf version 1.4 and version 1.7 documents. This is possibly related to https://tracker.moodle.org/browse/MDL-44426, however the issue here is not with Ghostscript. (I have seen the error on systems running Ghostscript version 9.06 and 9.10, and am currently testing with 9.18.) When viewed with Ghostscript from the command line, the pdf is displayed correctly. Furthermore, when "flattened" using Ghostscript

      $ gs -sDEVICE=pdfwrite -o flattened.pdf sample.pdf
      

      , the file can be resubmitted to the assignment, and then all parts appear.

      The issue may be with the FDPI library. When I upload the attached file to https://www.setasign.com/products/fpdi-pdf-parser/details/, the parser displays only the black layer, not the annotations. Per the FPDI Manual at https://manuals.setasign.com/fpdi-manual/v2/limitations/, "Dynamic content like link annotations, form fields or any other page annotations cannot be attached to a form XObject because they are related to the coordinates of the origin page. So FPDI is not able to import this kind of content."

      Since we are already using Ghostscript, would it be possible to flatten the file before it is processed with FPDI?

        Attachments

        1. MDL-64431.jpg
          MDL-64431.jpg
          49 kB
        2. sample.pdf
          181 kB

          Activity

            People

            • Votes:
              5 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

              • Created:
                Updated: