Fix Bug in Canvas display of pdfs

(1)

Bug: Canvas overrides user browser preferences when pdfs are linked from Canvas servers, forcing Canvas-hosted pdfs (or jpegs, etc.)  to download instead of being displayed within the browser. (This behavior does not happen on iPads; there the pdfs are displayed correctly.) As far as I can tell, there is no way to force Canvas to behave. This appears to be an issue with the HTTP headers being sent by the Canvas server.

There are numerous complaints about this on the Canvas communities.

Requested fix: Allow user browser preferences to determine whether the pdfs are displayed inline or downloaded.

------------------------------

(2) Current “solutions": This problem has been mentioned many times in the Canvas community over the past few years. When I raised this problem with Canvas support, the bug was acknowledged, and I was told there is currently no fix or workaround. Problematic workarounds that have been suggested as solutions are:

Host pdfs on Google drive: Although this solution works, it is horribly insecure, as anyone with the link (or any web crawler, I presume) will be able to access the files. In other words, all lectures and problem set solutions would be indexed by Google and freely available to the world. Very bad idea.

Insert pdf into a Canvas page, then open the page instead of the pdf: This solution limits accessibility for a number of reasons. First and foremost, this “solution” leads to a preview that is limited to a small part of the browser window with all of the Canvas menus and other crap taking up most of the display. This limits accessibility, particularly on laptops. Additionally, there are many reports of  problems with the inline Canvas display (e.g., chopping off pages, corrupt display). Math faculty who have many scanned pages of solutions appear particularly irate.

Convert all pdfs to jpeg: This creates accessibilty issues, takes faculty time, creates very bloated websites, and is a gnarly kludge.

Live with it: This sucks and does not conform to good website design. Why force students to download their homework, for example, and view it in a second application? There are many times when users just need to check something quickly (e.g, a problem set solution). If students prefer their pdfs to be downloaded, they can always override the website designer through their browser preferences.

------------------------------

(3) Possible solution:

Root cause: The origin of this behavior appears to be inappropriately set HTTP headers by the Canvas server. Any attempts to override this behavior (e.g., by setting the MIME type with a type="application/pdf" tag) will not work, because the server's instructions (i.e., HTTP headers) are supposed to override the browser.

Working from the suggestion on the Canvas user boards (look for comments by Wilmer Prentius), I examined the header being returned by Canvas when the pdf is served:

content-disposition: attachment; filename="Cornell_Notes.pdf"
content-type: application/pdf

This means that the browser knows it is getting a pdf (content-type) but the server is telling it to download the file irrespective of the user's preferences (content-disposition).

Other issues: See the comment by Karen Matson in the same thread on the Canvas user boards about problems with the native Canvas pdf preview. In my opinion, it is a bad idea to go with custom pdf previewers because of issues like this. It would be far better to allow previews by well tested software (e.g., Apple, Adobe).

Tags (2)
15 Comments
Stef_retired
Instructure Alumni
Instructure Alumni

Thanks for sharing this idea,  @mah11 ‌. Would you please provide the case number for your Canvas support interaction?

mah11
Community Explorer

stefaniesanders‌ The case number is 03976743.

stephenbreslin
Community Novice

I'd like this addressed too. Apart from user inconvenience, another issue with downloaded PDFs is a risk that users will continue to access the downloaded/offline PDF when an updated PDF is available.

desantij
Community Member

Ridiculous that this can't be addresed

helya
Community Member

I've spent hours trying to find a solution to why doc previews don't work for me and none of the existing threads have helped but I FINALLY FOUND IT

Some full access extensions on chrome that can read/write data can be culprits, for me this was Grammarly. Try disabling your extensions and adding them back one by one to find the culprit. You don't need to uninstall the extensions, just right click and set them to read and change site data only when you click the icon.

megande
Community Member

I would love to see this fixed!! It's definitely a pain to have students be forced to download the file when it's not something they actually need to do.

I haven't been able to get the inline preview to work either and even if I were to get it to work for myself I'm sure it would still be an issue for many students and I wouldn't want to have to try to troubleshoot that with them.

jennyread
Community Novice

Just adding my voice to request this (surely quite basic!) feature. 

lsullivan
Community Explorer

@mah11 I found a workaround for viewing a pdf in browser!!  It's not super pretty, but it works. 

--Go to files and click on the pdf to see it in 'preview' mode; copy that URL

--Now go to the page where you want to include the pdf.  Type the text for the pdf you want to link to

--Click the link button and paste the preview URL you copied

Students will now see the pdf in their browser!  (They can also download if from there if they want.)

 *If they click back, it will go back to the page they were on.  Unfortunately, if they click 'Close' it will put them in 'Files'.  But they can always click home.*

 

 

mah11
Community Explorer

@lsullivan Thanks for looking for a solution! Unfortunately, this does not work for me. On my computer (Mac/Safari), the file is still opened in the Canvas pdf browser.

lsullivan
Community Explorer

@mah11,  perhaps I misunderstood.  I thought you were looking for it to open in the browser (even within Canvas), just not automatically prompt for downloading.  Are you trying to get it to open in its own tab?

This is how it looks for me w/ Mac/Safari:  Screen Shot 2020-09-30 at 5.18.16 PM.png

 

mah11
Community Explorer

@lsullivan My display looks similar. What I would like Canvas to do is open the pdf full screen w/o the black header (Class schedule 20-21.pdf), the grey header (zooming tools), and the light grey surrounding border. This limits accessibility, particularly on laptops, and disrespects user browser preferences. Your solution is what I refer to as "Insert pdf into a Canvas page, then open the page instead of the pdf" in my post. 

lsullivan
Community Explorer

@mah11 OK...I did misunderstand then.  I definitely get your points and it would be nice for there to be an optimal solution.  It's a fairly decent workaround for us.  I'm on a laptop and I can see a good amount of the pdf.  

easleydr
Community Novice

Wow, you just awarded me an "Elf Panda" badge for having given this thread "kudos" a couple years ago.  Thanks!

Why not invest that energy in conforming to sensible, decades-old internet standards, and remove your weird hack that breaks pdf display in browsers?

I'm dumbfounded that you haven't fixed it yet.  I'm more dumbfounded that you chose to break it in the first place.  You don't even need to write any new code to fix it - just remove the offending code so that your web server complies with the standards.  Or explain to your customer base why you refuse to do so.

Thanks again for the "Elf Panda" badge.  

JackSnoeyink
Community Member

Fix this accessibility issue, please. (The jpeg workaround is just evil.)

 

ProductPanda
Instructure
Instructure
Status changed to: Archived
Comments from Instructure

As part of the new Ideas & Themes process, all ideas in Idea Conversations were reviewed by the Product Team. Any Idea that was associated with an identified theme was moved to the new Idea & Themes space. Any Idea that was not part of the move is being marked as Archived. This will preserve the history of the conversations while also letting Community members know that Instructure will not explore the request at this time.