Cannot open the pdf...

Cannot open the pdf...

by Josiah Carberry -
Number of replies: 15

There are various assignments in a course for which the students are asked to provide their answers directly in the online editing box. They are not asked to upload any files.

When I go to view the submissions, I always see the message "Cannot open the pdf. The file may be corrupt, or in an unsupported format." And yet, there should not be any pdfs to open.

So my questions are: whyever is this happening?; and how can I view the answers to the assignments? I know the answers are there, because I see them in the mdl_assignsubmission_onlinetextHide table.

Average of ratings: -
In reply to Josiah Carberry

Re: Cannot open the pdf...

by Emma Richardson -
Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Plugin developers

You are viewing the new pdf annotation grading window.  The online text submission should be in the left hand column.  You can hide the pdf window by clicking on the icons in the bottom right hand corner of the screen.

In reply to Emma Richardson

Re: Cannot open the pdf...

by Josiah Carberry -

Thanks for this, Emma.

Perhaps I am not being sufficiently clear about what is happening, so let me go through the steps:

Scenario 1:

1) I display the assignment with its grading summary

2) I click on View all submissions

3) I click on Grade for a row where the status is Submitted for grading (I should note that the display of the submission in the rightmost column is so narrow as to show only the first character on each line, making it completely worthless, but that is a different issue - see screen shot capture3.png)

4) The new page shows a large area on the left with the message "Generating the pdf..." and a somewhat smaller area on the right containing the online submission. On top of it all is the message "Alert. Cannot open the pdf..." (see capture2.png)

Now, it is true that I can click on an icon at the lower right to hide the left side, but I have to click on OK to hide the alert and click on the icon for every single submission. It seems to me that Moodle should not try to retrieve a pdf and display if the assignment is configured to accept only online submissions and it should not display an alert when it fails to do what it was never meant to do in the first place.


Scenario 2:

1) I display the assignment with its grading summary

2) I click on Grade.

3) Moodle displays the same two sections as above. for a student's submission, although it shows the records for all rows, not just the ones that have been submitted. While I can change the filter afterwards, why do I have to do this every time? If you are grading, wouldn't it make more sense to list by default the submissions that are ready for grading (or whatever default filter you want)?

Attachment capture2.png
Attachment capture3.png
In reply to Josiah Carberry

Re: Cannot open the pdf...

by Emma Richardson -
Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Plugin developers

I agree - it would be nice if we could select the default behavior.  You should put in a tracker request.  If you are not using the pdf annotation at all in the site, you can disable it under the admin settings.

In reply to Emma Richardson

Re: Cannot open the pdf...

by Josiah Carberry -

Are you referring to the settings for the Document converter plugin? If so, everything is already disabled there.

In reply to Josiah Carberry

Re: Cannot open the pdf...

by Josiah Carberry -

For whatever its worth, I had unoconv installed and enabled it in Moodle to see if that changed anything. It didn't. The error message still appears.

What puzzles me is that this doesn't seem to be an issue for anyone else, but I see no error messages when I enable debugging.

In reply to Josiah Carberry

Re: Cannot open the pdf...

by Emma Richardson -
Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Plugin developers

What do you mean by no-one is having a problem?  Are they able to open documents?  Are they appearing in the screen?  Or are they just not seeing the error message?  Oh, and I meant to disable the pdf annotation plugin...

In reply to Emma Richardson

Re: Cannot open the pdf...

by Josiah Carberry -

I think I am getting a little close to the nub of the issue.

I took a look at the pdf annotation plugin and ran a test to ensure that gs was correctly installed. Well, the test failed. Then I ran the same gs command from with the shell and it succeeded in creating the test png file. So gs is correctly installed so far as I can see. However, the way in which Moodle is executing it somehow falls in error. I am not sure what gs is supposed to be doing when you grade a submission, but if Moodle is not handling it correctly, that would explain the error I am seeing. But I see no error messages when debugging is on, so I don't know how to proceed in troubleshooting.

In reply to Josiah Carberry

Re: Cannot open the pdf...

by Emma Richardson -
Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Plugin developers

Unoconv is what is needed to do the conversions - have you set that up?

In reply to Emma Richardson

Re: Cannot open the pdf...

by Josiah Carberry -

I think this thread might as well be closed. There remain various things that don't work, but I don't won't to use them, either. By disabling the pdf annotation plugin, the whole mess goes away and I achieve what I need.

I will come back to this issue if ever I need to allow file submissions instead of online submissions.

In reply to Josiah Carberry

Re: Cannot open the pdf...

by AL Rachels -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers

Hi Josiah,

From what you describe, I suspect the paths have not been set for ghost script and unoconv. You can check if you go to Administration > Site administration > Server > System paths. A checkmark at the end of the path boxes means Moodle found the item and of course an X means it needs to be fixed.

In reply to AL Rachels

Re: Cannot open the pdf...

by Josiah Carberry -

Thanks, Al, but that is not the problem.

In reply to Josiah Carberry

Re: Cannot open the pdf...

by Miguel Fabo -

Josiah, could you finally fix this? I'm having the same problem and I feel clueless.

In reply to Miguel Fabo

Re: Cannot open the pdf...

by Josiah Carberry -

I just disabled the annotation plugin, as I don't need that functionality. As a result, the unwanted messages disappeared.

In reply to Josiah Carberry

Re: Cannot open the pdf...

by Miguel Fabo -

I suspected it. Thanks a lot for your feedback, Josiah!

In reply to Josiah Carberry

Re: Cannot open the pdf...

by jb estrigan -

hello josiah


how did you disable your annotation plugin?
its because of the pdf error


ty