Is it possible to display a pdf file link or embed a pdf in the book module?
Many thanks, Justin
Is it possible to display a pdf file link or embed a pdf in the book module?
Many thanks, Justin
Yes -- I'm using 2.8 and can successfully embed a PDF into a Book Module via a Google Drive embed code, as well as link the file within the book module itself. It's similar to working with a Page resource.
Alternatively you can:
If your pdf file is already on the web, just copy its link and paste it as above - no need to place it in the orphaned activities.
Hope it helps!
Hi Rossana,
Thanks so much for the above.
I'm using v2.9 and your instruction all work except for the last point about PDFs that are already on the web. I can't seem to get them to work.
I am copying and pasting its complete URL over the above red section of the html script. Am I missing something?
Thanks,
Matt
I am experiencing a similar problem. To try to identify where the issue is I'm using a Page resource. An embed of an external JPEG works fine. An embed of a PDF is blank. The two resources come from the same server and both can be accessed publicly when clicking on the link used.
Are there limitations on embed codes?
can u tel me how to embedded the pdf file in page module
First off..
A few Tools to use..
As we want our pdf's to be as small as possible so they travel
quickly and that we can use the other free tools available.
https://smallpdf.com/compress-pdf
Upload your file.. then download it..
https://www.idrsolutions.com/online-pdf-to-html5-converter/
Upload and convert.
Download the zip file.
Set up the "Orphaning Activities in Moodle"
I used this as a guide
Once you have this setup and note before you turn it into an Orphaned Activities
Set up an activity "File"
Note, I found that once I turned this Section into an Orphaning Activity, I had to duplicate the first
Activity and go in and edit it for other PDF's I wanted to add into this book.
Now you need to upload your Zip file you downloaded from the HTML5 converter
Unzip it, it will create the directory you need.
Delete the zip after as you don't need it..
Now the tricky bit that took me a little to work out..
I am using chrome.. I had trouble with using the directions in post two.
The way its working for me was open Chrome and use the developers tools.
you need to look for something like this...
moodle/pluginfile.php/671/mod_resource/content/6/WS_TDG_38_17_10_16_compressed/index.html
So now we are ready to open another page in the book we are making..
Add the page and insert the code as per post two.. but now we are add in our uploaded file directory..
Copy its link and paste it into this HTML code, substituting the red string
<center><embed src="yourdomain.com/mod/resource/view.php?id=443#toolbar=1&navpanes=1&scrollbar=1" quality="low"height="540" width="720" /></center>
Note the change in driectory we are pointing to via my example.. I have cut the HTTP: off the front so make sure you have yours in your path..
I also changed the "540" to "740"
Now with luck.. you have your book of PDF's working as HTML5 now..
Working for me..
As a thought on this, I went the other way and setup a dummy course.
This way I can load all of my PDF resources and sections I would like to use.
I then have hidden it from view and this works as well as using the orphaned technique
As a note,
I had to also go into "Book admin"
Edit "permissions" "View bookmod/book:read" to allow logged in students to view it..
Took a few to get back to me with feedback on this one as they were getting a "students don't have view permissions"
Here's a method I use with the Atto File drag & drop plugin that doesn't require Orphaned activities:
<center> <embed width="95%" height="600" src="LinkToPDFyouJustUploaded" ></center>
Just had time to get back to this and been playing with it..
I was having trouble getting the PDF's to load using this method but seems to be working now. I am using Chrome and Moodle 3.1
Atto Drop and drag is not working for me it seems to want to open the pdf in another tab and not leave a link there for me, so I have had to do this workaround.
Anyways here is my working version, note working in both Book and Single Page.
1: Load a pdf into the site via the files option and or file picker within the "Link" option
2: Going the "Link" button, head to "recent files". you should be able to see the file you just uploaded.
Right click and "copy link address" (note this is within Chrome), now that you have this link you can copy it into the Editor or another opened editor you may be using for copy-paste functions. ( I use notepad++ as it keeps any coding clean)
3: Add in the code as above <center> <embed width="95%" height="600" src="http://YOURSITE CODE /*.pdf"></center>
Save and it should be showing.
Note within this code you are seeing it has a reference to the file actually being within a "mod_book/chapter", this is because I have run a test within another area of the site to play with this code. So the file I have chosen is still linked back to that module. This still does work with direct links you may generate.
You will also notice that once you save the content and go back to edit it, Moodle will have added some extra code onto the end of it to identify this activity for tracking. example,
moodle/draftfile.php/5/user/draft/981727052/silica-lung-factsheet.pdf" internalinstanceid="226">
just worked out another nice way.. still in testing mode but looks promising..