PDF Files change default resource like PDF.js

PDF Files change default resource like PDF.js

by Shane Ryan Diaz -
Number of replies: 3

In Moodle 2.9 platform, we use the https://moodle.org/plugins/mod_pdfjsfolder Module

In the course home page , if a file with a .pdf extension is added by using the " drag and drop" , create a pdfjsfolder resource in the section in which we do drag and drop.
The title of the resource will be the name of the PDF file.
We must create a resource for each added PDF.

If the file has another extension, other than .pdf , add the file as the default mode of Moodle.

If possible, add these modifications in a custom plugin in / local

Average of ratings: -
In reply to Shane Ryan Diaz

Re: PDF Files change default resource like PDF.js

by Davo Smith -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

It's not really clear from your post what you are saying.

Are you saying that this plugin already supports drag and drop handling?

Or are you saying you have developed this any wish to release it?

Or are you saying that you would like this plugin to support drag and drop handling?

If it is the last one, then it doesn't need a local plugin, it just needs the plugin itself to add a couple of small functions to enable drag and drop handling support - it can be set to specifically handle files with extension '.pdf'.


In reply to Davo Smith

Re: PDF Files change default resource like PDF.js

by Shane Ryan Diaz -

moodle use the default Files when adding PDF files.

I need to change the default moodle systems that will use PDF.js Files.

In reply to Shane Ryan Diaz

Re: PDF Files change default resource like PDF.js

by Davo Smith -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

If you look in mod/resource/lib.php, you will see that there are 2 functions, 'resource_dndupload_register' and 'resource_dndupload_handle'.

If you edit mod/pdfjsfolder/lib.php, you should be able to add 2 similar functions, 'pdfjsfolder_dndupload_register' and 'pdfjsfolder_dndupload_handle'. You should set the 'extension' to 'pdf', then put some appropriate code in the 'pdfjsfolder_dndupload_handle' function.

Once that is done, dragging and dropping a pdf onto the course page will offer you a choice to either create a file resource or a PDF JS folder resource.

Once you have this working, I would suggest you offer your code back to the developer of PDF.js.