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

PDF conversion hangs for PDFs with lots of vector graphics

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Minor Minor
    • None
    • 3.9.6, 3.10.3, 3.11
    • Assignment
    • MOODLE_310_STABLE, MOODLE_311_STABLE, MOODLE_39_STABLE
    • MDL-71434_master
    • Hide

      Annotate the submission offline.

      Show
      Annotate the submission offline.
    • 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.

      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.

            tschroeder Tim Schroeder
            tschroeder Tim Schroeder
            Simey Lameze Simey Lameze
            Votes:
            1 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:

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

                  Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.