Cannot open the PDF. The file may be corrupt, or in an unsupported format

Cannot open the PDF. The file may be corrupt, or in an unsupported format

by Perry Way -
Number of replies: 3

While attempting to grade assignments, regardless of the content (or lack of content) submitted, our instructors are all getting this error. Here is a screenshot of me attempting to grade an assignment. I yellowed out identifying information for privacy.

screenshot of error

Before I go further, we are on Windows, using IIS, and our Moodle version is 3.9.6, PHP is 7.4.23, and we are newly installed on an upgraded server (a new one).

Before I made this post I researched this error and found it is a common issue brought up with a multitude of "fixes". I tried everything that I could to eliminate the cause of this problem. A common "fix" was to check to make sure Ghostscript is installed. So I downloaded it and installed the Windows X64 version, thinking that would most likely solve this problem. But it did nothing to solve the problem. I do not recall ever having to install Ghostscript on any previous server we used (two of them).

I need help at this point. I've followed all the lead I could find to rectify the issue. That said, it's not completely preventing grading because the instructor can click on the button and then still grade the item. But it is very annoying and furthermore it does not open the content submitted should it be a Word document or an image, into the viewer so that instructor can view it and annotate it for grading purposes.

Average of ratings: Useful (1)
In reply to Perry Way

Re: Cannot open the PDF. The file may be corrupt, or in an unsupported format

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
What was the format of the original file? What are using for document conversion?
In reply to Howard Miller

Re: Cannot open the PDF. The file may be corrupt, or in an unsupported format

by Perry Way -
Hi Howard, thanks for taking an interest in this situation.

The error happens with no files, and with any kind of file actually. Most of our students are submitting homework in Word documents (*.docx) or Excel or Powerpoint formats, but we have some submitting image files and some using plain .txt text files, some zip up multiple files in .zip files. Even PDFs error. It just errors on everything, regardless.

As for document conversion I'm not sure how to answer that. This is a new server that I had to set up after our last one got mangled up and crash dived into hell. So perhaps I've not set up something properly?

Another note of possible concern is our Moodledata folder got mangled pretty badly during backup (our backup provider skipped a kazillion files) so when I restored it to the new server it provided numerous errors for our instructors and students trying to access previously uploaded works. I've been working on restoring our Moodledata system, removing files that were corrupted. I still have to delete older files that should not be there but that our backup provider held onto for years (some since 2014) due to their not doing backups that mirror the source (differential) but just keep adding new content (incremental, though they call it differential). Could a mangled Moodledata have destroyed something necessary to make the PDF conversion work properly? I kind of doubt so, but thought I would mention this for full disclosure consideration.
In reply to Howard Miller

Re: Cannot open the PDF. The file may be corrupt, or in an unsupported format

by Perry Way -
I just figured it out. Wow, this was a trip down a rabbit's hole, to be sure. I do not ever recall having to set this up before, yet it worked. Now on a new server I finally have it working by installing python and unoconv and creating the .bat file and all that. Really, I do not ever recall doing this before. And now a test run works.