PDFs not loading with 1.9

PDFs not loading with 1.9

by Kent Villard -
Number of replies: 47
Has anyone come across a problem with PDFs loading. Things were working well and now I have instructors and students saying that they cannot load PDFs. When they click on a link to a PDF they get a window saying that you can click to download the PDF and the browser will then stall and the PDF never loads.

Any thoughts
Average of ratings: -
In reply to Kent Villard

Re: PDFs not loading with 1.9

by Mary Cooch -
Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Testers Picture of Translators
Is it with IE7? Have you tried going into the settings for that resource and ticking the 'force download' option?
In reply to Mary Cooch

Re: PDFs not loading with 1.9

by Ellen Marie Murphy -
My instructors are having the same problem. They do not want to force students to download the documents, however. I don't understand what changed between 1.8 and 1.9
In reply to Ellen Marie Murphy

Re: PDFs not loading with 1.9

by Christoph Ruda -

Hi Ellen,

Forcing the download as Mary suggested only means that the browser will not try to display the file but will present you with an option to open or save it. If you chose 'Open' the file will be opened in your default pdf viewer application (most likely Acrobat reader). We found this gives us the most consistent behaviour across different browsers and operating systems.

The issue could have another reason though. We found that Windows XP behaves differently compared to Vista. We too have trouble with opening pdf file on some of our Vista machines; computers running XP don't show the issue. Our technicians are investigating as we speak.

Christoph

In reply to Mary Cooch

Re: PDFs not loading with 1.9

by David O'Brien -
~Hello
We were having all of the above issues in IE and FF. A simply update to Adobe Reader 9 fixed all of these problems.
Regards
In reply to Kent Villard

Re: PDFs not loading with 1.9

by Ron Dunn -
I had the same problem, with the exciting addition of the Firefox browser crashing. Since the documents opened when I used Moodle on IE and Chrome, as an experiment I reinstalled Firefox 2.0 (I had upgraded before Moodle 1.9 was available), and the problem disappeared. Since our school year has not yet begun, I'm able to work on my site, but worry about the experience my students are going to have. I'm using a PC, and according to my own institution's tech support, this problem isn't occurring on Macs. Thus, it seems like an interface between the new Firefox and new Moodle versions. Has anyone pinpointed the issue?
In reply to Ron Dunn

Re: PDFs not loading with 1.9

by Barbara Braun -
Hi - we might have the same problem. We are testing various browsers at the moment but it seems to run everywhere else. Anyone? This is serious!
Greetings Barbara
In reply to Barbara Braun

Re: PDFs not loading with 1.9

by Sean S -
I'm having trouble with this in IE & FF on both xp & vista computers
In reply to Sean S

Re: PDFs not loading with 1.9

by John White -
Ron, Barbara, Sean, Ellen,

It sounds like there are a mixture of different but equally awful problems with these pdfs!

Some wish to force a download and there is a setting for that as Mary says; some wish the opposite - to open the pdf in the browser i.e. within a Moodle page (the latter is definitely my preference so as to keep the work-flow flowing, but I don't always get what I want).
In all cases you are at the mercy of how the browser on the client machine is set up, as unlike mp3 or flv files (for example) Moodle does not hand out the reader/player for the pdf file-type.
So if the experience is flaky you should be looking at the browser installation, and consequently making it work on one machine doesn't make it work across your establishment!

If you run Firefox 3.0 on a Mac (OS X 10.4) you will probably find that irrespective of what you ask for in Moodle the pdf is only ever offered as a download, and after I had banged my head against a brick wall for a while I read (but unfortunately now can't find!) a note on Adobe's site to say that the Acrobat Reader Plugin is not supported for Firefox 3! In other words hard luck folks! angry
To confirm this I go to Firefox->Preferences->Applications and sure enough the only item available to PDF types is 'Preview' i.e Download to the Preview application!
This would probably explain why back-tracking to an older Firefox (and thus with it an older Reader plugin that was supported) did make it work on Mac.
It may also mean that trying to get the old plugin to work on the new browser will crash it!

By contrast if I look at Firefox 3.0.1 on PC (running XP) and go to Tools->Options->Applications then PDF files are set to 'Use Adobe Acrobat (in Firefox)', and sure enough, the PDF opens happily within the browser on my Moodle page! smile

Then if I try exactly the same thing in IE7 on PC and look at Tools->Internet Options->Programs->Manage Add-ons I have entries for 'Adobe PDF Reader' (ActiveX Control), and 'Adobe PDF Reader Link Helper' (Browser Helper Object). Both are enabled, and the pdf opens in the browser in the Moodle page exactly as expected. smile

Now back at the Mac, this time in Safari 3.1.2, I go to Help->Installed Plugins and find that PDF file-types and a load of others from Adobe are handled by the AdobePDFViewer.plugin, and naturally this means I get to see the pdf in the Moodle page again. Now there's a surprise surprise wink

So all this suggests that if you have a crashing browser you may have tried mix-and-match with plugins - you have to use the right one for your browser;
...if you only get offered the download when you wanted the in-page reader then you haven't got the plugin installed or enabled (or it doesn't exist!!!);
...if you work around the Firefox/Mac problem by installing a third-party plugin no-one else will have it so your site won't behave the same on the next machine;
...and if you work for Adobe its about time you swallowed the fact that most Macs (and a big selection of PCs) use Firefox and offer us the plugins we need! evil

I hope that helps. Regards,

John


Average of ratings: Useful (1)
In reply to John White

Re: PDFs not loading with 1.9

by Vincent Short -
Great thanks


i thought i was going to have Force download on all the .pdf ressources but now i just post the instructions smile

cheers
V
In reply to John White

Re: PDFs not loading with 1.9

by Bob Puffer -
John,
Your information seems clear and very useful. We have encountered some additional, seemingly related problems not addressed:
  1. Once the "Force download" setting is "set" it does not allow you to unset it.
  2. On many occasions the "Force download" setting will not "stick". Even though you cannot change it once its set (as mentioned in #1) when you return, it is unset and the pdf document doesn't load correctly. I've seen this happen before my eyes. And I've seen it happen after days go by.
  3. I can access the very same pdf document from the same course using the same computer on the same browser (Firefox) with the same version in two different instances of Moodle (1.65+ and 1.92+) and have the earlier open it without a problem while 1.92+ won't.
I think there really is more going on here than just browsers not playing well with plugins.
In reply to Bob Puffer

Re: PDFs not loading with 1.9

by John White -
Bob,

There is plainly an interaction between moodle and the browser that is tricky to deal with.

On point 1 I think I would try actually editing the database to see if fixes the unset issue. You can open the table mdl_resource and find the named pdf in question.
If you have set this to Force Download you will find that its 'options' field is set to 'forcedownload'.
You can switch to edit mode, using the pencil icon, and just delete the 'forcedownload' setting. Then click Save.

For point 2, I wondered if you were using 1.9.2 weekly updates? As I don't know whether such an update would reset these resources to default.
Though perhaps this is not the connection at all!

And point 3 does suggest that there is a database difference that is causing issues - but what I don't know!

Regards,

John
Average of ratings: Useful (1)
In reply to John White

Re: PDFs not loading with 1.9

by John White -
...further on Point 3...

could this be a cookie issue?
something tracking that a particular pdf resourse has already been opened straight into Preview and so repeating the same process enough after you have changed the setting?

JW
In reply to John White

Re: PDFs not loading with 1.9

by Jez H -
I seriously doubt it is a cookie issue... I would have thought it is more likely to be the file handler in Moodle.

If you look at that code it there are a load of routines that try to determine the correct headers etc... quite convoluted.

Also, one error we saw was a reference to a security issue bringing in content from another domain, i.e. embedding external PDF's. I dont know if some browser setting was treating this like some kind of XSS exploit... seemed a bit weird. I suppose that would imply that perhaps the way embedding of files has changed on 1.9.

It would be worth adding the 1.6 / 1.9 comparison to the bug tracker.
In reply to Bob Puffer

Re: PDFs not loading with 1.9

by Anthony Borrow -
Picture of Core developers Picture of Plugin developers Picture of Testers
Bob - Regarding point #3, I too have had an issue with PDFs. In FF3 under Ubuntu I get a gray box and cannot view the document (unless force download is on which is the option we have gone with at this site). In FF3 under XP (or at least a virtual machine running XP) I had no problem. My experience leads me to believe that it is an issue with the FF PDF plugin in Linux. I would have to investigate further and look at the code to see the differences in how the file is being treated between 1.6 and 1.9 but I do not see this as an issue with Moodle code. I never thought I would be one to point fingers, but my guess is that it is an Adobe issue and that the best place to report it is with them. I think I read some similar complains on the Firefox forums so we are not alone. Peace - Anthony
In reply to Anthony Borrow

Re: PDFs not loading with 1.9

by Michael Daykin -
I am also experiencing a similar issue. When PDFs are embedded I'm just getting a blank box. It just started this week I thought was odd. Looking at the URL lines for each of these I did notice that this week the resource's ids passed 100. So my pdfs that have a two digit id do work but those that have a 3 digit id do not. I know it could be a browser/plugin issue but I have run into programming issues before where the difference of one digit causes an issue.
In reply to John White

Re: PDFs not loading with 1.9

by Rosario Carcò -

I am experiencing all the mentioned behaviours since I started with our Moodle 1.7 18 months ago. From time to time we had students complaining about PDF (and other docs) not opening in IE 6 and later IE 7. We advised to use FireFox 2 or right klick in IE to open the File in a new window or tab. Then I upgraded to 1.9.2+ and everything seemed to work again and some weeks ago things worsened and we had to advise again the trick with right mouse click. Then I found a Microsoft KB article (http://support.microsoft.com/kb/815313/en-us) explaining the "force download" option for https sites like our Moodle. Once this option set, things seemed to work again.

There is also an open issue in the Tracker: http://tracker.moodle.org/browse/MDL-9614

But today students complained again and I was not able to open PDFs any more. So my actual workaround is to set the "force download" option in Moodle for every resource. But you see that this would mean a lot of work for all teachers having to change this option on every PDF and other Docs they uploaded.

And nobody seems to know how long this workaround will give us a rest in the whole affair. FireFox 3 has also been reported to me from Teachers does not refresh the submitted pages, so that changes can not immediately be seeen.

Rosario

In reply to John White

More head banging

by Martin Huntley -
I too have been banging my head on this one.

Here's a couple of things to add to John White's nice summary of some of the variations (I'm using Moodle 1.9.3 Build 20080723.):

From John:
Now back at the Mac, this time in Safari 3.1.2, I go to Help->Installed Plugins and find that PDF file-types and a load of others from Adobe are handled by the AdobePDFViewer.plugin, and naturally this means I get to see the pdf in the Moodle page again. Now there's a surprise.

This is true (with recent versions of Adobe Reader - at least 8 and 9) ONLY IF Adobe Reader itself is set to Display files in web browser using...Reader (Reader/Preferences/Internet). If you turn this off, Safari will use its own built-in Webkit (and will not show the Adobe plugin as loaded), but will still display the PDF within the browser window. (Make sure you quit and re-launch Safari after changing this Reader setting.)

Also, the Safari Help instructions on Viewing PDFs refer only to the Webkit-based viewing. They note that mousing over the bottom of the PDF page opens a toolbar with several options including Open PDF in Preview and Save PDF to downloads folder. (Open in Preview actually opens the file in Reader if that is your default app for PDFs.) The Adobe plugin based display of the PDF has different controls, always visible at top of the displayed file.

Short of tinkering with the Safari code in ways that most of my users aren't equipped to do, there does not appear to be any way to get Safari to immediately open a PDF in an external app.

From John:
Then if I try ... in IE7 on PC and look at Tools->Internet Options->Programs->Manage Add-ons I have entries for 'Adobe PDF Reader' (ActiveX Control), and 'Adobe PDF Reader Link Helper' (Browser Helper Object). Both are enabled, and the pdf opens in the browser in the Moodle page exactly as expected.

Here too, "Adobe PDF Reader" shows as an add-on ONLY IF Reader is set to Display PDF in browser (Edit/Preferences/Internet). Turn this off and IE 7 will respond to direct links to PDFs by opening them outside of the browser.

BUT (and this is nasty!), if you have a Resource link in Moodle to a PDF which is not set as "Forced Download", clicking on that link brings up a Moodle resource page with a big empty hole for the PDF above the summary (unlike FF3 which instead provides a direct link to the PDF to allow it to be opened externally).

So, for my Mac users, I'm saying: set Adobe Reader to NOT display PDFs in browser, and then use Firefox if you want PDFs displayed outside the browser, Safari if you want them displayed in the browser (though I don't recommend Safari for Moodle use).

For my PC users, I have to tell them to leave Adobe Reader at its default config of Display PDFs in browser, because otherwise IE breaks with files not set for Force download. In this case, they can use FF3 if they always want PDFs displayed externally, or IE7 if they want them displayed in the browser.


Martin
In reply to Martin Huntley

Re: More head banging

by Martin Huntley -
Well, yesterday I repeatedly replicated the problem I described with IE - when Reader is set to not display PDFs in browser and the resource link is not set as "Force download" the Moodle resource page shows an empty box where the PDF would otherwise display inline and provides no way to view/download the PDF.

Today, no such problem, and as far as I can tell I'm testing with all the same parameters!! Something must be different but I can't figure what.

With Moodle 1.9.3, FF3 (Win) does have a (replicable) version of this problem. Under these same conditions, FF3 (Win) brings up the Moodle resource page with a hole where the PDF would be (though no outlined box as I'd experienced with IE), but does also automatically open the PDF in Reader.

I've mitigated this problem by editing /mod/resources/type/file/resource.class.php so that the summary displays above the PDF rather than below it.

I'll take a look at Mauno's fix later.
In reply to John White

Re: PDFs not loading with 1.9

by Pauline McNamara -
Just for info, we were just testing a pdf in Moodle 1.9 today using a Mac and FF 3. There is indeed a plugin that works with FF 3 on Mac to view pdfs within the browser:


http://code.google.com/p/firefox-mac-pdf/


Though the pdf was set to force download, it opened in a new window - still, it was viewable. (It also opened for view in a new window on Windows with FF 3.)


In reply to Pauline McNamara

Re: PDFs not loading with 1.9

by John White -
Pauline,

Thanks for the reference, but in the answer there lies the problem!
You can of course install a plug-in (in this case the Quartz plug-in) to make Firefox behave with pdfs. But you have to install it on EVERY target machine that might access your site. Or at very least put the reference to the plug-in and tell client computer users to install it!

This still remains a very unsatisfactory situation. Whereas if Adobe supplied Firefox with a plug-in (or Firefox was permitted to write/modify one) and it was packaged in a Firefox upgrade, the problem would disappear almost overnight!

Politics!

John
In reply to John White

Re: PDFs not loading with 1.9

by Catherine Berry -
I am finding that Firefox crashes every time I try to open a pdf. I am using Vista with Firefox 3.0.6 and Moodle 1.9.3.

Firefox is fine with XP, and IE is fine for both XP and Vista - it is only the Firefox/Vista combination which is a problem for me.

Does anyone have any suggestions?

Thanks.
In reply to Catherine Berry

Re: PDFs not loading with 1.9

by Stephen Wilkinson -
I'm having exactly the same problem using Vista, Firefox 3.0.5 and Moodle 1.9.4.

Interestingly, it used to work for me with Vista, Firefox 3.0.5 and Moodle 1.9.3+. The problems have appeared since I upgraded to Moodle 1.9.4 yesterday.

Any suggestions please? Or do we have to Force Downloads for all PDFS?

Thanks.
In reply to Catherine Berry

Re: PDFs not loading with 1.9

by Marc Grober -
If firefox is actually crashing that is something that should invoke the the little app to report the error, and there might be some info on the mozilla site. You might try to experiment with setting firefox to use acrobat as a helper app in a new window as opposed to a plugin in the same window, then look in your system log and post what you see.

I supposed another option that lots have taken is to replace Vista with XP. I believe MS is releasing an SP for Vista momentarily..... and that may cure some ills....

Of course, one could argue that you should use a reliable OS, but I imagine you really don;t want to hear that.....
In reply to Marc Grober

Re: PDFs not loading with 1.9

by Catherine Berry -
Thank you Marc for your reply.

I have reported the error, and I can't find anything on the mozilla site.

I've tried disabling the acrobat plugin, and the result is that it asks me if I want to download or open using acrobat, and it will then open, but it appears on the download bar so it is must be downloading, and I don't really want it to download every pdf I look at.

I've tried looking in the Vista system log, but don't really know what I'm looking for.

I've also looked at the crash report, and it says "Crash reason: Exception Access Violation". Does this help at all?

Thanks.
In reply to Catherine Berry

Re: PDFs not loading with 1.9

by Marc Grober -
In fact your pdf file is downloading no matter which way you view it.... the plugin simply hides it from you. You can use reader as a helper app without any problem....

In the interim, I spent 5 minutes and can suggest the following may be of interest:

a) clean out all acrobat and reinstall to make sure you have the latest version and nothing else.
b) peruse the following thead http://www.adobeforums.com/webx/.59b5bfca
c) check out these URLS:
http://kb.adobe.com/selfservice/viewContent.do?externalId=328233
http://kb.adobe.com/selfservice/viewContent.do?externalId=kb404291
In reply to Catherine Berry

Re: PDFs not loading with 1.9

by Alasdair McAndrew -
I have found the simplest way to get pdf files to display is to make them available from a web page; so that the moodle resource is a web page with a pdf file in it. I can't get pdf files to display from within moodle (1.9.4), whereas they display in firefox with no trouble, so I expect the problem is a problem with moodle.

-Alasdair
In reply to Alasdair McAndrew

Re: PDFs not loading with 1.9

by Catherine Berry -
Thanks Marc, I have been through all your suggestions, to no avail.

As Alasdair says, it does seem to be a problem with Moodle. I have no problem displaying pdfs in Firefox from other websites, and if I click on a pdf within my Moodle files, it opens with no problem. It is only in resources where Moodle embeds the pdf within the page, that the crash happens.

I can work round this by using IE or by disabling my Adobe plugin, but I'm wondering how widespread this problem is - do all Vista/Firefox/Moodle users have the same issue?
In reply to Catherine Berry

Re: PDFs not loading with 1.9

by Itamar Tzadok -
Have you tried ticking the 'Force download' option in the resource settings? It seems to work around the problem. smile
In reply to Itamar Tzadok

Re: PDFs not loading with 1.9

by Petrus 4 -
Hi Itamer,

what application are you referring to in which you tick the "force download" option?
In reply to Petrus 4

Re: PDFs not loading with 1.9

by Itamar Tzadok -
It is in the 'Link to a file or web site' resource settings page. See image. smile


Attachment res-link-forcedownload.png
In reply to Catherine Berry

Re: PDFs not loading with 1.9

by heli g -
I have had same Vista/Firefox/Moodle problem (Firefox crashed when I tried to open pdf Resources).

The problem was resolved by upgrading to Adobe Acrobat Reader 9.
In reply to Kent Villard

Re: PDFs not loading with 1.9

by Jez H -
Yes I have had this problem, the workaround I used was to modify:

moodle/mod/resource/type/file/resource.class.php

around line 254 in the "pdf bit" change $embedded = true; to $embedded = false;

} else if ($mimetype == 'application/pdf' || $mimetype == 'application/x-pdf') {
$resourcetype = "pdf";
$embedded = false;

Around line 322 add another condition to the if statement that forces download, i.e. add " || $resourcetype == "pdf" ":

if ($resource->options == 'forcedownload' || $resourcetype == "pdf") {
$fullurl .= $forcedownloadsep . 'forcedownload=1';
}

I could not find and admin setting to do this site wide from Moodle, and am assuming a code change is the only way to do it on a site wide basis?
Average of ratings: Useful (1)
In reply to Jez H

Re: PDFs not loading with 1.9

by Mariana vd Walt -
Thanks! I made these source code changes and it resolved the problem for me.

Regards
Mariana
In reply to Jez H

Re: PDFs not loading with 1.9

by Martin Huntley -
The problem with approaches like this that effectively mean there's no difference between having "Force download" on or off is that, sometimes, you want the option of displaying the resource summary when someone clicks the resource link. For example, you might be using the resource summary to maintain a history of updates to the linked document.
In reply to Kent Villard

Re: PDFs not loading with 1.9

by Jez H -
A colleague told me today that it is likely to be the use of objects within Moodle code that is causing the problem. Well, that is not strictly true, I think Moodle do it correctly but a hack is required to get it working in IE7.

I will try and get more info to post to the bug tracker, but that would explain why earlier versions still work.
In reply to Jez H

Re: PDFs not loading with 1.9

by Jez H -
Ok I consulted "the Oracle" once more and he told be there is an issue with the Object / Mime types in IE7. He said it was possible to work around this using "conditional comments" which work in IE but not other browsers.

He said its a bit of a hack but it is possible to get it working.

Looking at the bug tracker:

http://tracker.moodle.org/browse/MDL-13818

It seems that it was not decided to implement that work around, as it is "not a Moodle issue".

That tracker then refers to:

http://tracker.moodle.org/browse/MDL-13903

where the "solution" is to force download.

That is what my change above does... force download, but it would be better if you used the patched files from the am tracker.

Sooooo it seems there is an IE7 workaround but the developers have decided not to persue that option.... instead forcing download of PDF's in Moodle. Perhaps they anticipate that Adobe / Microsoft will resolve the issue in their upgrades.

Jez
In reply to Jez H

Re: PDFs not loading with 1.9

by Christoph Ruda -

The problem exists not only for files you link to through resources. We had trouble with .doc files linked to from html page type resources. The solution for us was a hack which is described here (including a link to the Modules and plug-ins database). The beauty of this approach is that you have control over what file types are forced to be downloaded.

Christoph

In reply to Christoph Ruda

IE7 becomes a serious Moodle problem

by Ger Tielemans -
Having the same problems with PDF (and NOT wanting that ugly force download) we now also see the same problem with .mp3 when we use the multimediafilter.

The .mp3 link works fine in the other browser versions and other browsers, but not in IE7. Anyone else having this problem?

(And please Headquarter, come with a workaround for IE7!)
In reply to Kent Villard

Re: PDFs not loading with 1.9

by Dave Brown -
I'm having a similar problem with FF3 and IE7 - Moodle 1.9.2

IE7 has had this problem ever since I installed 1.9.2. I could see no PDF file directly from the browser but the whole file would appear when I clicked the "Direct Link" option. Now sometimes the file does not appear after the "Direct Link" option.

FF3 just began having this problem a couple of weeks ago. The PDF file seems to show up from the browser the first time I request it but subsequent requests are commonly blank (not always -seems random) and I can't open a window image with the "Direct Link" option, however, the download window shows that the download occurred. What is interesting and possibly a clue is that when the PDF text does not appear from the browser, the pop-up window has scroll bars as if there were some text there - it is just blank.

I installed using Fantastico - I see there is a new upgrade available via Fantastico but the version number is not identified. Considering some problems that always crop up with new upgrades, I'm leery of doing this during the quarter.

Could this have to do with the browser blocking pop-ups?
In reply to Dave Brown

Re: PDFs not loading with 1.9

by Chandrasekhar D V -
Hi all,

we just installed the 1.9 version and started uploading a few documents. Initially the pdfs were opening and there was no issue. After a while, the PDFs were not opening in the frontpage or as part of the course. However, on the same system, the document opens from Site files without any issue ruling out any browser installation / configuration problems.. Wonder what the reason could be??
In reply to Chandrasekhar D V

Re: PDFs not loading with 1.9

by Mariana vd Walt -
I am using Firefox 3.0.1 and cannot even force download pdf files (my browser freezes). The only thing I can do is to rename the file - removing the .pdf and then rename it to have the .pdf again after I have downloaded it.

It works fine in IE 7.

Mariana
In reply to Chandrasekhar D V

Re: PDFs not loading with 1.9

by Patrick Lyne -

I have noticed that when replacing a pdf with a more recent version in Moodle that afterwards the browser (Firefox) crashed when trying to load the pdf to view.  I noted that this problem was unique to Firefox browser as the file loaded in IE and Chrome. I cleared recent history in Firefox and afterwards the pdf loaded no problem.

In reply to Kent Villard

Re: PDFs not loading with 1.9

by Gabriel Lucas -
Our Mac / Safari / PDF problem is that clikcing on a PDF resource re-routes a student to the login page, and subsequently logs them out. Even checking "force download" does not work. Right-clicking on the resource doesn't work either...it just downloads the login screen.

Is anyone having this trouble?