# In plaats van PDF te downloaden, hoe forceer je PDF om alleen in de browser te openen/bekijken?

**URL:** https://meta.discourse.org/t/instead-of-downloading-pdf-how-to-force-pdf-to-open-view-in-browser-only/167435
**Category:** Support
**Created:** [17 oktober 2020 om 12:12 UTC](https://meta.discourse.org/t/instead-of-downloading-pdf-how-to-force-pdf-to-open-view-in-browser-only/167435 "2020-10-17T12:12:02Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![avndp](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/avndp/32/186766_2.png) [@avndp](https://meta.discourse.org/u/avndp)
#### Post date: [17 oktober 2020 om 12:12 UTC](https://meta.discourse.org/t/instead-of-downloading-pdf-how-to-force-pdf-to-open-view-in-browser-only/167435/1 "2020-10-17T12:12:02Z")

</div>

Whenever I upload a PDF, it shows in the topic as follows:

![image](https://global.discourse-cdn.com/meta/original/3X/f/b/fbde59f72ec0bf13b382ff8f82258e441c116d3d.png)

I’m using Inline PDF to display it in Desktop version. But, in mobile Inline PDF won’t work. Further, Google or other search engines autodetect the PDF files, but whenever the user clicks on those results, the PDF download dialogue will appear instead of opening in a tab. This is a bit unfriendly and most of the users prefer to view the PDF online instead of downloading it at a place and opening.

Is there any solution to this?

NOTE: I’ve seen this topic [PDF onebox instead of download, on uploaded files](https://meta.discourse.org/t/pdf-preview-instead-of-download-on-uploaded-files/151995), but the topic ended without any relation to the original question. Hence, this new topic.

---

<div class="post-metadata">

### Author: ![jord8on](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jord8on/32/166809_2.png) [@jord8on](https://meta.discourse.org/u/jord8on)
#### Post date: [21 oktober 2020 om 21:29 UTC](https://meta.discourse.org/t/instead-of-downloading-pdf-how-to-force-pdf-to-open-view-in-browser-only/167435/2 "2020-10-21T21:29:34Z")

</div>

Thanks for raising this question. I’m also curious to know the answer!

---

<div class="post-metadata">

### Author: ![denvergeeks](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/denvergeeks/32/327671_2.png) [@denvergeeks](https://meta.discourse.org/u/denvergeeks)
#### Post date: [8 november 2022 om 07:36 UTC](https://meta.discourse.org/t/instead-of-downloading-pdf-how-to-force-pdf-to-open-view-in-browser-only/167435/3 "2022-11-08T07:36:13Z")

</div>

### Embed a PDF Stored on Google Drive

PDFs display in Mobile as well as Desktop.

(My preferred method so **PDFs** in iFrames display in any device as _ **responsive** _)

1. Share
2. Copy Share Link
3. Open Share Link in a New Tab
4. Click the 3 Vertical Dots in the Top Right Corner
5. Select Embed Item
6. Copy the Displayed iFrame Code
7. Paste it in the [Discourse](https://www.discourse.org/) Composer / Editor

**Desktop Example…**

 ![discourse-pdf-embed-from-google-drive](https://global.discourse-cdn.com/meta/original/4X/6/1/9/619e7c0401bfc4fe5448f1759ad475cc86fd20d1.png)

**Mobile Example…**

 ![discourse-pdf-embed-mobile-from-google-drive](https://global.discourse-cdn.com/meta/original/4X/b/a/0/ba066d05582f0d3f2f3a135ef9ad2ff99dc185b8.png)

---

<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: [4 maart 2023 om 08:45 UTC](https://meta.discourse.org/t/instead-of-downloading-pdf-how-to-force-pdf-to-open-view-in-browser-only/167435/4 "2023-03-04T08:45:28Z")

</div>

Inline PDF does not work for me on desktop either.

I’m partially successful displaying PDFs inline when adding them to `FileHelper.inline_images`

> <https://github.com/discourse/discourse/blob/1c9f300896b06d736381f976f49dbfc767a7b958/lib/file_helper.rb#L164-L167>

But then a parameter “inline=1” is needed:

> <https://github.com/discourse/discourse/blob/1c9f300896b06d736381f976f49dbfc767a7b958/app/controllers/uploads_controller.rb#L323-L327>

This could be added in some theme-component ([Inline PDF Previews](https://meta.discourse.org/t/inline-pdf-previews/157649)).

I would like to learn a clean way to switch discourse to serve PDFs with `content-disposition: inline` using a plugin or a [configuration option](https://meta.discourse.org/t/add-configuration-option-to-serve-local-pdf-uploads-inline/257040).

---

<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: [5 maart 2023 om 12:41 UTC](https://meta.discourse.org/t/instead-of-downloading-pdf-how-to-force-pdf-to-open-view-in-browser-only/167435/5 "2023-03-05T12:41:46Z")

</div>

I managed to write a small plugin for this purpose:

[https://github.com/thoka/discourse-send-pdf-inline](https://github.com/thoka/discourse-send-pdf-inline)
