PDF.js Folder

Activities ::: mod_pdfjsfolder
Maintained by André Camacho
PDF.js Folder is a plugin intended to make sure that added PDF files always open in the browser.
Latest release:
83 sites
96 downloads
35 fans
Current versions available: 1

PDF.js folder is a Moodle 4.5+ plugin intended to make sure that PDF files always open in the browser (with the option of downloading), regardless of if the user is using a desktop or mobile device and giving each student the same features.

  • How PDFs are opened in browsers seem to depend on many things, like which browser the user is using, the configuration of PDF readers and which operating system is being used. To a smaller degree, it depends on the settings in Moodle.
  • In most cases, the handling of PDFs should be left under the control of the user but in some cases there are valid reasons to try to standardize the experience.

PDF.js folder is built on PDF.js:

  • PDF.js is Portable Document Format (PDF) viewer that is built with HTML5.
  • PDF.js is community-driven and supported by Mozilla Labs. Our goal is to create a general-purpose, web standards-based platform for parsing and rendering PDFs.
  • PDF.js, can perform poorly on mobile devices with limited memory and processing power. Some PDFs are fine but others are too big, to complex, contain too many images, etc. Your mileage may vary.

PDF.js folder works much like the regular folder resource in Moodle, but only files with .pdf type(s) can be uploaded.

There are a few options, allowing you to chose if :

  • Files should open in the current tab/window or in a new one
  • Subfolders should be shown expanded or not
  • Download links should be displayed for each PDF file
  • A warning about changes made in PDF.js not being saved/persisted should be shown on activity page
  • PDF.js should use the legacy viewer* or modern one

*Legacy viewer exists because PDF files have some problems showing in the modern PDF.js viewer on some specific computers (MacOS 13/14 with Safe Exam Browser 3.6 for example).

Screenshots

Screenshot #0
Screenshot #1
Screenshot #2

Contributors

André Camacho (Lead maintainer)
Jonas Nockert: Original author
Please login to view contributors details and/or to contact them

Comments

Mostrar comentarios
  • Mulyadi Ibrahim
    vie, 16 de oct de 2015, 11:48
    Hi

    Can this plugin be used for Moodle 2.9+?
  • Paul KIng
    dom, 27 de mar de 2016, 12:04
    Hmm.. I'd really like to use this module in 3.0 (but it won't install)
  • steve baxter
    mié, 6 de abr de 2016, 21:54
    Paul, try changing the $module entries in version.php to $plugin which means it will be 'seen' by Moodle 3. Seems to work fine for me.
  • Marcel Matschke
    jue, 11 de may de 2017, 21:23
    Can be used in 3.2.3 with changes of steve.
  • Marcel Matschke
    mar, 16 de may de 2017, 17:05
    Can be used in 3.3. With some slight changes, it supports more than PDF´s.
  • Jörg Schäfer
    mar, 5 de sept de 2017, 19:10
    Can I confirm - we use the module with modifications under moodle3.3.1
    in addition we have restricted pdfjs - no save, no print, no copy
  • Gizmapps. Gizmapps.
    mar, 7 de nov de 2017, 02:54
    i did everything you suggested and now i have this : Coding error detected, it must be fixed by a programmer: cm_info::get_custom_data() can not be used anymore. Please use the property cm_info->customdata instead
  • Andrew Makarov
    jue, 31 de oct de 2019, 11:16
    If still interesting need change $cm->get_custom_data() on $cm->customdata in 436 and 451 strings in file pdfjsfolder/lib.php
    It's worked on my Moodle 3.7.2+ (Build: 20191025)
  • Manoj Thakur
    mié, 18 de dic de 2019, 16:10
    [Error] Unsupported syntax detected in version.php file [$module]
    Installation aborted due to validation failure,
  • Manoj Thakur
    dom, 22 de dic de 2019, 00:46
    [Error] Unsupported syntax detected in version.php file [$module]
    Installation aborted due to validation failure,
    What to do?
  • Manoj Thakur
    sáb, 22 de feb de 2020, 15:45
    Does somebody reply here?
  • Toshihiro KITA
    jue, 7 de may de 2020, 20:54
    For Moodle 3.8, I was successful to install this plugin with the following modifications:

    --- mod/pdfjsfolder/version.php.orig 2020-05-07 16:30:28.370170868 +0900
    +++ mod/pdfjsfolder/version.php 2020-05-07 16:30:50.806427814 +0900
    @@ -27,9 +27,9 @@

    defined('MOODLE_INTERNAL') || die();

    -$module->version = 2013120300;
    -$module->requires = 2012120300;
    -$module->cron = 0;
    -$module->component = 'mod_pdfjsfolder';
    -$module->maturity = MATURITY_BETA;
    -$module->release = '0.14';
    +$plugin->version = 2013120300;
    +$plugin->requires = 2012120300;
    +$plugin->cron = 0;
    +$plugin->component = 'mod_pdfjsfolder';
    +$plugin->maturity = MATURITY_BETA;
    +$plugin->release = '0.14';

    --- mod/pdfjsfolder/lib.php.orig 2020-05-07 16:35:25.249570732 +0900
    +++ mod/pdfjsfolder/lib.php 2020-05-07 21:50:38.558981806 +0900
    @@ -433,7 +433,7 @@
    function pdfjsfolder_cm_info_dynamic(cm_info $cm) {
    // The field 'customdata' is filled in only if folder is to be
    // shown inline.
    - if ($cm->get_custom_data()) {
    + if ($cm->customdata) {
    $cm->set_no_view_link();
    }
    }
    @@ -448,7 +448,7 @@
    global $PAGE, $DB;

    if ($cm->uservisible &&
    - $cm->get_custom_data() &&
    + $cm->customdata &&
    has_capability('mod/pdfjsfolder:view', $cm->context)) {
    require_once(dirname(__FILE__) . '/locallib.php');
  • Toshihiro KITA
    vie, 26 de jun de 2020, 22:56
    > For Moodle 3.8, I was successful to install this plugin with the following modifications:

    I received a message that says my post is not clear, so I rewrite the post to show how you should modify the pdf.js files:

    In version.php under mod/pdfjsfolder/ , find the lines like

    $module->version = 2013120300;
    $module->requires = 2012120300;
    $module->cron = 0;
    $module->component = 'mod_pdfjsfolder';
    $module->maturity = MATURITY_BETA;
    $module->release = '0.14';

    and modify them to

    $plugin->version = 2013120300;
    $plugin->requires = 2012120300;
    $plugin->cron = 0;
    $plugin->component = 'mod_pdfjsfolder';
    $plugin->maturity = MATURITY_BETA;
    $plugin->release = '0.14';


    In lib.php under mod/pdfjsfolder/ , find the line like

    if ($cm->get_custom_data()) {

    and modify it to

    if ($cm->customdata) {

    and also find the line like

    $cm->get_custom_data() &&

    and modify it to

    $cm->customdata &&


    That is all you have to do to make PDF.js Folder installable.
  • Onyet Studio
    lun, 1 de feb de 2021, 13:28
    I managed to change some code with the latest Moodle standards, and the plugin works for Moodle 3.10+
    You can download it on my github onyet/onyetmpdf
  • André Camacho
    lun, 1 de dic de 2025, 19:51
    Dear all, the plugin has been updated to work with Moodle 4.5+, 5.0+.
1 2
Please login to post comments