# Discourse send PDF inline

**URL:** https://meta.discourse.org/t/discourse-send-pdf-inline/280875
**Category:** Plugin
**Created:** [October 3, 2023, 11:22am UTC](https://meta.discourse.org/t/discourse-send-pdf-inline/280875 "2023-10-03T11:22:28Z")
**Posts on this page:** 12
**Page:** 1

<div class="post-metadata">

### Author: ![thoka](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/thoka/32/115652_2.png) [@thoka](https://meta.discourse.org/u/thoka)
#### Post date: [October 3, 2023, 11:22am UTC](https://meta.discourse.org/t/discourse-send-pdf-inline/280875/1 "2023-10-03T11:22:29Z")

</div>

| | | |
| --- | --- | --- |
| ℹ | **Summary** | Show local served PDFs in the browser |
| 🛠 | **Repository Link** | [GitHub - thoka/discourse-send-pdf-inline: Patch discourse do serve PDFs inline · GitHub](https://github.com/thoka/discourse-send-pdf-inline) |
| 📖 | **Install Guide** | [How to install plugins in Discourse](https://meta.discourse.org/t/install-plugins-in-discourse/19157) |

  

### Features

Uploaded PDFs are opened with “content disposition inline”, which allows them to [be displayed in the browser](https://meta.discourse.org/t/add-configuration-option-to-serve-local-pdf-uploads-inline/257040) instead of being offered for download.

### Configuration

Not necessary.

---

<div class="post-metadata">

### Author: ![nathank](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/nathank/32/290039_2.png) [@nathank](https://meta.discourse.org/u/nathank)
#### Post date: [October 3, 2023, 11:34am UTC](https://meta.discourse.org/t/discourse-send-pdf-inline/280875/3 "2023-10-03T11:34:19Z")

</div>

How is this different / better than the existing Theme Component to do the same?

> [@Inline PDF Previews](https://meta.discourse.org/t/inline-pdf-previews/157649):
>
> discourse2Summary Inline PDF Previews is a desktop-only theme component that will allow you to create previews for pdf attachments.eyeglassesPreview [Preview on Discourse Theme Creator](https://discourse.theme-creator.io/theme/Discourse/inline-pdf-previews) (desktop only)hammer_and_wrenchRepository Link [https://github.com/discourse/discourse-pdf-previews](https://github.com/discourse/discourse-pdf-previews)open_bookNew to Discourse Themes? [Beginner’s guide to using Discourse Themes](https://meta.discourse.org/t/beginners-guide-to-using-discourse-themes/91966) Install this theme component Features before after …

---

<div class="post-metadata">

### Author: ![Canapin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/canapin/32/119591_2.png) [@Canapin](https://meta.discourse.org/u/Canapin)
#### Post date: [October 3, 2023, 11:35am UTC](https://meta.discourse.org/t/discourse-send-pdf-inline/280875/4 "2023-10-03T11:35:35Z")

</div>

The plugin directly opens the PDF in the browser, not in an embedded element inside a post 🙂

This was a feature request: [Add configuration option to serve local PDF uploads inline](https://meta.discourse.org/t/add-configuration-option-to-serve-local-pdf-uploads-inline/257040)

---

<div class="post-metadata">

### Author: ![Jagster](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jagster/32/192154_2.png) [@Jagster](https://meta.discourse.org/u/Jagster)
#### Post date: [October 3, 2023, 11:43am UTC](https://meta.discourse.org/t/discourse-send-pdf-inline/280875/5 "2023-10-03T11:43:33Z")

</div>

Does _local_ mean S3 and similar plus CDN will fail when using this plugin?

---

<div class="post-metadata">

### Author: ![thoka](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/thoka/32/115652_2.png) [@thoka](https://meta.discourse.org/u/thoka)
#### Post date: [October 3, 2023, 11:45am UTC](https://meta.discourse.org/t/discourse-send-pdf-inline/280875/6 "2023-10-03T11:45:03Z")

</div>

It does not alter the way, S3 serves PDFs.  
Side effects would be magic.

---

<div class="post-metadata">

### Author: ![meglio](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/meglio/32/71444_2.png) [@meglio](https://meta.discourse.org/u/meglio)
#### Post date: [July 1, 2024, 1:15am UTC](https://meta.discourse.org/t/discourse-send-pdf-inline/280875/7 "2024-07-01T01:15:06Z")

</div>

Is this plugin still in a working condition?

---

<div class="post-metadata">

### Author: ![thoka](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/thoka/32/115652_2.png) [@thoka](https://meta.discourse.org/u/thoka)
#### Post date: [July 1, 2024, 3:56am UTC](https://meta.discourse.org/t/discourse-send-pdf-inline/280875/8 "2024-07-01T03:56:21Z")

</div>

We are still using it.

---

<div class="post-metadata">

### Author: ![thoka](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/thoka/32/115652_2.png) [@thoka](https://meta.discourse.org/u/thoka)
#### Post date: [October 16, 2024, 3:53pm UTC](https://meta.discourse.org/t/discourse-send-pdf-inline/280875/9 "2024-10-16T15:53:36Z")

</div>

~~Unfortunately, it’s broken currently.~~  
I have to investigate.

---

<div class="post-metadata">

### Author: ![ajschmidt](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/ajschmidt/32/453388_2.png) [@ajschmidt](https://meta.discourse.org/u/ajschmidt)
#### Post date: [November 12, 2024, 4:30am UTC](https://meta.discourse.org/t/discourse-send-pdf-inline/280875/11 "2024-11-12T04:30:54Z")

</div>

Maybe I’m naive, but I think most people would want PDFs to render in the browser by default.

@thoka, is there any reason you opted to publish a plugin for this functionality rather than trying to upstream it into Discourse?

---

<div class="post-metadata">

### Author: ![thoka](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/thoka/32/115652_2.png) [@thoka](https://meta.discourse.org/u/thoka)
#### Post date: [November 13, 2024, 6:58am UTC](https://meta.discourse.org/t/discourse-send-pdf-inline/280875/12 "2024-11-13T06:58:41Z")

</div>

I found time to test it.  
The plugin is working as expected.  
I do not understand, what might have caused problems in the meantime.

---

<div class="post-metadata">

### Author: ![thoka](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/thoka/32/115652_2.png) [@thoka](https://meta.discourse.org/u/thoka)
#### Post date: [November 13, 2024, 7:42am UTC](https://meta.discourse.org/t/discourse-send-pdf-inline/280875/13 "2024-11-13T07:42:27Z")

</div>

I wrote the plugin, since there were no responses to [my feature request](https://meta.discourse.org/t/add-configuration-option-to-serve-local-pdf-uploads-inline/257040).

When thinking about drawbacks of sending PDFs to the browser directly, I envision the following potential issues:

When utilizing Discourse as a Progressive Web App on a mobile device, one inevitably exits the Discourse interface, or rather its user interface, to display the PDF, thereby relying on the user’s familiarity with navigating back to the original application.

Furthermore, when it comes to mobile devices, one is at the mercy of how the browser handles inline PDFs. While Firefox currently displays the file directly, it appears that there is no way to persuade Chrome to do so:

> <https://android.stackexchange.com/questions/230250/open-pdf-files-directly-in-chrome-for-android>

---

<div class="post-metadata">

### Author: ![Canapin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/canapin/32/119591_2.png) [@Canapin](https://meta.discourse.org/u/Canapin)
#### Post date: [February 17, 2026, 9:30am UTC](https://meta.discourse.org/t/discourse-send-pdf-inline/280875/14 "2026-02-17T09:30:33Z")

</div>

Not needed anymore! 🥳

> [@Make PDFs open directly (not via download) by default](https://meta.discourse.org/t/make-pdfs-open-directly-not-via-download-by-default/388190/12):
>
> This should be resolved since [SECURITY: Download allowlist for uploaded files · discourse/discourse@9c0642a · GitHub](https://github.com/discourse/discourse/commit/9c0642a2e79040a140b99601296cb10cf425eb9f) We now have centralised logic to determine which files should be shown ‘inline’. That means that PDFs are consistently shown inline, and some less safe file types are consistently served as downloads. These changes should work on all types of upload storage (local & S3, with or without CDNs).
