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

Option to set PDF font in course settings for generated PDF files

XMLWordPrintable

    • MOODLE_26_STABLE, MOODLE_310_STABLE, MOODLE_311_STABLE, MOODLE_32_STABLE, MOODLE_39_STABLE, MOODLE_402_STABLE
    • MOODLE_402_STABLE
    • MDL-45301_master_v3
    • Hide

      New option test - single font

      1. Check if there is no `$CFG->pdfexportfont` set in config.php
      2. Turn on "Enable PDF export font" option in "Site administration > General > Language > Language settings".
      3. Confirm there is no "PDF font" option in "Site administration > Courses > "Course default settings > Files and uploads".
      4. Go "Add a new course" from "Site administration > Courses", and confirm there is no "PDF font" option in "Files and uploads".
      5. Set `$CFG->pdfexportfont = ['freesans' => 'FreeSans'];` in config.php.
      6. Confirm there is no "PDF font" option in "Site administration > Courses > "Course default settings > Files and uploads".
      7. Go "Add a new course" from "Site administration > Courses", and confirm there is no "PDF font" option in "Files and uploads".

      Convert test - single font

      1. Create a course.
      2. Create an Assignment activity and set "Submission types" with "File submissions" and "Annotate PDF" is ON.
      3. Login as a student and submit a PDF file for the assignment activity.
      4. Login as a teacher and choose "View all submissions" for the assignment activity.
      5. Click "Grade" button for the student to show grading page.
      6. Add a comment in Japanese "テストの注釈1" using annotation tool.
      7. Click "Save changes"
      8. Click a file from "Download feedback PDF" to download the annotated PDF file.
      9. Confirm the comment in the last page of downloaded PDF is NOT same as what input "テストの注釈1".
      10. Set `$CFG->pdfexportfont = ['kozminproregular' => 'Kozmin Pro Regular'];` in config.php.
      11. Go grading page again, and add another comment with "テストの注釈2"
      12. Click "Save changes" and download the file from "Download feedback PDF".
      13. Confirm the comment in the last page of downloaded PDF is same as what input "テストの注釈2".

      New option test - multiple fonts

      1. Set `$CFG->pdfexportfont = ['freesans' => 'FreeSans', 'kozminproregular' => 'Kozmin Pro Regular', 'invalidfont' => 'Invalid'];`  in config.php.
      2. Turn off "Enable PDF export font" option in "Site administration > General > Language > Language settings".
      3. Confirm there is no "PDF export font" option in "Site administration > Courses > "Course default settings > Files and uploads".
      4. Go "Add a new course" from "Site administration > Courses", and confirm there is no "PDF export font" option in "Files and uploads".
      5. Turn on "Enable PDF fonts" option in "Site administration > General > Language > Language settings".
      6. Confirm there is "PDF fonts" dropdown option and the dropdown has "FreeSans" and "Kozmin Pro Regular", not "Invalid" in "Site administration > Courses > "Course default settings > Files and uploads". Leave the option for "FreeSans".
      7. Go "Add a new course" from "Site administration > Courses", and confirm there is "PDF export font" option in "Files and uploads" and it's selected "FreeSans".
      8. Update "PDF export font" option in "Site administration > Courses > "Course default settings > Files and uploads" to "Kozmin Pro Regular".
      9. Go "Add a new course" from "Site administration > Courses", and confirm there is "PDF export font" option in "Files and uploads" and it's selected "Kozmin Pro Regular".

      Convert test - multiple fonts

      1. Create a course with "FreeSans" option for "PDF export font".
      2. Create an Assignment activity and set "Submission types" with "File submissions" and "Annotate PDF" is ON.
      3. Login as a student and submit a PDF file for the assignment activity.
      4. Login as a teacher and choose "View all submissions" for the assignment activity.
      5. Click "Grade" button for the student to show grading page.
      6. Add a comment in Japanese "テストの注釈1" using annotation tool.
      7. Click "Save changes"
      8. Click a file from "Download feedback PDF" to download the annotated PDF file.
      9. Confirm the comment in the last page of downloaded PDF is NOT same as what input "テストの注釈1".
      10. Go to the course setting page and set "PDF export font" from "FreeSans" to "Kozmin Pro Regular".
      11. Go grading page again, and add another comment with "テストの注釈2"
      12. Click "Save changes" and download the file from "Download feedback PDF".
      13. Confirm the comment in the last page of downloaded PDF is same as what input "テストの注釈2".

      Backup/restore test

      1. Backup the course which is used in convert test.
      2. Restore the course and confirm the setting of "PDF export font" is "Kozmin Pro Regular".
      Show
      New option test - single font Check if there is no `$CFG->pdfexportfont` set in config.php Turn on "Enable PDF export font" option in "Site administration > General > Language > Language settings". Confirm there is no "PDF font" option in "Site administration > Courses > "Course default settings > Files and uploads". Go "Add a new course" from "Site administration > Courses", and  confirm there is no "PDF font" option in "Files and uploads". Set `$CFG->pdfexportfont = ['freesans' => 'FreeSans'] ;` in config.php. Confirm there is no "PDF font" option in "Site administration > Courses > "Course default settings > Files and uploads". Go "Add a new course" from "Site administration > Courses", and  confirm there is no "PDF font" option in "Files and uploads". Convert test - single font Create a course. Create an Assignment activity and set "Submission types" with "File submissions" and "Annotate PDF" is ON. Login as a student and submit a PDF file for the assignment activity. Login as a teacher and choose "View all submissions" for the assignment activity. Click "Grade" button for the student to show grading page. Add a comment in Japanese "テストの注釈1" using annotation tool. Click "Save changes" Click a file from "Download feedback PDF" to download the annotated PDF file. Confirm the comment in the last page of downloaded PDF is NOT same as what input "テストの注釈1". Set `$CFG->pdfexportfont = ['kozminproregular' => 'Kozmin Pro Regular'] ;` in config.php. Go grading page again, and add another comment with "テストの注釈2" Click "Save changes" and download the file from "Download feedback PDF". Confirm the comment in the last page of downloaded PDF is same as what input "テストの注釈2". New option test - multiple fonts Set `$CFG->pdfexportfont = ['freesans' => 'FreeSans', 'kozminproregular' => 'Kozmin Pro Regular', 'invalidfont' => 'Invalid'] ;`  in config.php. Turn off "Enable PDF export font" option in "Site administration > General > Language > Language settings". Confirm there is no "PDF export font" option in "Site administration > Courses > "Course default settings > Files and uploads". Go "Add a new course" from "Site administration > Courses", and  confirm there is no "PDF export font" option in "Files and uploads". Turn on "Enable PDF fonts" option in "Site administration > General > Language > Language settings". Confirm there is "PDF fonts" dropdown option and the dropdown has "FreeSans" and "Kozmin Pro Regular", not "Invalid" in "Site administration > Courses > "Course default settings > Files and uploads". Leave the option for "FreeSans". Go "Add a new course" from "Site administration > Courses", and  confirm there is "PDF export font" option in "Files and uploads" and it's selected "FreeSans". Update "PDF export font" option in "Site administration > Courses > "Course default settings > Files and uploads" to "Kozmin Pro Regular". Go "Add a new course" from "Site administration > Courses", and  confirm there is "PDF export font" option in "Files and uploads" and it's selected "Kozmin Pro Regular". Convert test - multiple fonts Create a course with "FreeSans" option for "PDF export font". Create an Assignment activity and set "Submission types" with "File submissions" and "Annotate PDF" is ON. Login as a student and submit a PDF file for the assignment activity. Login as a teacher and choose "View all submissions" for the assignment activity. Click "Grade" button for the student to show grading page. Add a comment in Japanese "テストの注釈1" using annotation tool. Click "Save changes" Click a file from "Download feedback PDF" to download the annotated PDF file. Confirm the comment in the last page of downloaded PDF is NOT same as what input "テストの注釈1". Go to the course setting page and set "PDF export font" from "FreeSans" to "Kozmin Pro Regular". Go grading page again, and add another comment with "テストの注釈2" Click "Save changes" and download the file from "Download feedback PDF". Confirm the comment in the last page of downloaded PDF is same as what input "テストの注釈2". Backup/restore test Backup the course which is used in convert test. Restore the course and confirm the setting of "PDF export font" is "Kozmin Pro Regular".

      Using multi-byte string like Japanese, EditPDF editor page display properly (fig1). But download annotated PDF are not properly (fig2).
      $this->SetFont() method in mod/feedback/editpdf/classes/pdf.php cause this problem. When I change font to 'kozgopromedium', problem is resolved (fig3).

      So please add font option in EditPDF configuration.

        1. (I) Passed -- (Master)MDL-45301.png
          (I) Passed -- (Master)MDL-45301.png
          8 kB
        2. (II) Passed -- (Master)MDL-45301.png
          (II) Passed -- (Master)MDL-45301.png
          58 kB
        3. (III) Passed -- (Master)MDL-45301.png
          (III) Passed -- (Master)MDL-45301.png
          4 kB
        4. (IV) Passed -- (Master)MDL-45301.png
          (IV) Passed -- (Master)MDL-45301.png
          58 kB
        5. fig1.png
          fig1.png
          28 kB
        6. fig2.png
          fig2.png
          11 kB
        7. fig3.png
          fig3.png
          12 kB
        8. image-2023-02-02-15-00-00-150.png
          image-2023-02-02-15-00-00-150.png
          17 kB
        9. image-2023-02-02-15-00-26-687.png
          image-2023-02-02-15-00-26-687.png
          62 kB
        10. Organic Agriculture.pdf
          211 kB
        11. pdfexportfont_coursesetting.png
          pdfexportfont_coursesetting.png
          32 kB
        12. settingscolumn.png
          settingscolumn.png
          73 kB

            Votes:
            14 Vote for this issue
            Watchers:
            31 Start watching this issue

              Created:
              Updated:
              Resolved:

                Estimated:
                Original Estimate - 0 minutes
                0m
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 5 hours, 31 minutes
                5h 31m

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