Add configuration option to serve local PDF uploads inline

AI-generated summary

The discussion centers on adding a configuration option to serve local PDF uploads inline (via content-disposition: inline) rather than forcing downloads, improving user experience—especially on mobile. thoka notes that current behavior hinders PDF accessibility, citing broken workarounds like the Inline PDF Previews Theme Component due to bugs and lack of mobile support. nathank agrees, emphasizing that users typically want to read PDFs immediately, not download them, and highlights Android-specific frustrations where downloaded PDFs can’t be re-opened without duplicating files. Later, nathank confirms the issue has been resolved, calling the new behavior “so much better,” suggesting the feature request is now complete. Tags: completed, pdf-previews.

Our incoming communication (via email) is heavily dependent on PDFs.

Current behaviour of discourse is to serve this files as download only.

What risks do you see adding a configuration option, which set content-disposition: inline for PDFs or maybe also other file formats?

5 Likes

This makes a lot more sense to me than the current default behaviour.

When I encounter a PDF in a post, I generally want to read it - not download it. Almost all PDF viewers allow the reader to download the file (if they wish) quite easily.

The current behaviour causes a particular problem in Android, where if a PDF has already been downloaded it simply asks if you wish to download it again. If you say ‘no’, you don’t get to read it. If you say yes, you add another copy to your downloads folder. Both suck a bit.

Of note, the Inline PDF Previews Theme Component would almost do the desired behaviour if

  1. this bug is fixed
    and
  2. it applied opening in new tabs to mobile as well
2 Likes

I think this has been fixed / sorted now and this feature request can be closed.

It is so much better!!!

1 Like