Host a PDF

AI-generated summary

The user asks if it’s possible to host a PDF on a Discourse instance so it can be viewed online via the domain, rather than being downloaded. maiki confirms that PDFs can be uploaded and viewed as attachments, but notes that the file is still downloaded to the user’s device. JammyDodger suggests using a theme component or plugin to enable inline PDF previews in the browser. maiki clarifies that while the PDF appears to be viewed online, it is still cached locally, and advises on handling large files by creating smaller versions or providing text content instead. The user thanks both for the helpful solutions anon82911141.

Hi,

Is it possible to host a PDF on a Discourse instance? Meaning that you could go to discourse.example.com/random-file.pdf and you’d be able to access it from there.

Thanks!

If the instance allows for file uploads with the .pdf extension, it will look like this:

oakland-sorting-guide.pdf (2.1 MB)

Does that answer your question? :slight_smile:


Original link is https://www.oaklandrecycles.com/wp-content/uploads/2022/06/oakland-sorting-guide.pdf, found at Recycling - Oakland Recycles.

Hi there,

I wanted it to be viewable on the domain - not downloadable, so that instead of downloading to the user’s device, they could view it online.

Is that possible?

Thanks!

There’s the Inline PDF Previews theme component that might be of some use, or a plugin variation that allows PDFs to be opened in the browser Discourse send PDF inline.

What you are describing is called “reading the PDF in the web browser”. The links JammyDodger shared will assist you to achieve that effect with Discourse.

However, the PDF files are still downloaded to the user’s device; it is cached in the browser as a downloaded resource being shown to the user.

I understand that some folks like offering the option to read in the browser, I know I’ve made use of this in policy-making instances where we had to read a lot of PDFs obtained from public data dumps.

A separate concern is that large PDFs would take up too much for user devices, due to network or storage limitations; the way to address this issue is by creating smaller PDFs or making that information available as text in a topic. :+1:

@JammyDodger @maiki Many thanks for your help - those are the solutions I wanted to achieve!