Affects Version/s: 3.4.6, 3.5.5, 3.5.6, 3.9.3, 3.10, 3.11
Fix Version/s: None
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):
- Navigate to a course.
- Navigate to the Participants list.
- 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.
- Go back to the course page and turn editing on.
- Add an activity or resource: Assignment
- 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):
- In the file-submission assignment you created...
- Click "Add submission"
- Drag and drop the attached file "sample.pdf"
- Click "Save Changes" to return to the assignment main page.
- Click "View all submissions"
- You should see your own submission, with status "Submitted for grading", or "Draft (not submitted)". Click "Grade" beside your submission.
- In the default layout, wait until you see an image of the pdf submitted where you can add annotations.
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.
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.
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
, 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?