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

PDF conversion hangs for PDFs with lots of vector graphics

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Reopened
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: 3.9.6, 3.10.3, 3.11
    • Fix Version/s: None
    • Component/s: Assignment
    • Labels:
    • Affected Branches:
      MOODLE_310_STABLE, MOODLE_311_STABLE, MOODLE_39_STABLE
    • Pull Master Branch:
      MDL-71434_master
    • Workaround:
      Hide

      Annotate the submission offline.

      Show
      Annotate the submission offline.
    • Testing Instructions:
      Hide
      1. For the duration of this test disable either the Moodle cronjob or just the task `\assignfeedback_editpdf\task\convert_submissions`
      2. Create an assignment.
      3. Enable "PDF Annotation" as the only feedback type.
      4. Submit the attached source.pdf as a student.
      5. Grade the submission.
        Moodle should generate the preview in less than a minute.
      Show
      For the duration of this test disable either the Moodle cronjob or just the task `\assignfeedback_editpdf\task\convert_submissions` Create an assignment. Enable "PDF Annotation" as the only feedback type. Submit the attached source.pdf as a student. Grade the submission. Moodle should generate the preview in less than a minute.

      Description

      When you submit the attached source.pdf in an assignment that uses PDF annotation for feedback the file will be converted into a PNG preview image. That's done via these commands:

      gs -q -sDEVICE=pdfwrite -dBATCH -dNOPAUSE -sOutputFile=target.pdf source.pdf
      gs -q -sDEVICE=png16m -dSAFER -dBATCH -dNOPAUSE -r100 -dFirstPage=1 -dLastPage=1 -dDOINTERPOLATE -dGraphicsAlphaBits=4 -dTextAlphaBits=4 -sOutputFile=page1.png target.pdf
      

      For the attached source.pdf this takes 20min in my test with one core at 100% utilization the whole time. (The attached pdf is just one page of an actual pdf file submission of one of our students. I tried converting the original pdf submission but cancelled it after 1.5 hours.) If the conversion happens live as the teacher is in the grading interface it just hangs for him and actually the whole Moodle sessions hangs. He then has to clear cookies and log in again to use Moodle at all.

      In MDL-64431 someone suggested using `pdfimage24` instead of `pdfwrite` to solve a different problem. I tried `pdfimage24` here and with it the attached pdf gets converted in only 20s. So a 60x speedup in this case.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              tschroeder Tim Schroeder
              Reporter:
              tschroeder Tim Schroeder
              Peer reviewer:
              Simey Lameze Simey Lameze
              Participants:
              Component watchers:
              Adrian Greeve, Jake Dallimore, Mathew May, Mihail Geshoski, Peter Dias, Sujith Haridasan
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Dates

                Created:
                Updated:

                  Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0 minutes
                  0m
                  Logged:
                  Time Spent - 48 minutes
                  48m