# Inline PDF Previews

**URL:** https://meta.discourse.org/t/inline-pdf-previews/157649
**Category:** Theme component
**Tags:** official, desktop, pdf-previews
**Created:** [July 13, 2020, 9:18pm UTC](https://meta.discourse.org/t/inline-pdf-previews/157649 "2020-07-13T21:18:10Z")
**Posts on this page:** 20
**Page:** 6

<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: [March 5, 2023, 3:05pm UTC](https://meta.discourse.org/t/inline-pdf-previews/157649/118 "2023-03-05T15:05:25Z")

</div>

> [@thoka](#):
>
> a small plugin

Is this a plugin or component?

---

<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: [March 5, 2023, 3:10pm UTC](https://meta.discourse.org/t/inline-pdf-previews/157649/119 "2023-03-05T15:10:17Z")

</div>

I was not able to achieve the desired behaviour with a component.

---

<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: [March 5, 2023, 3:36pm UTC](https://meta.discourse.org/t/inline-pdf-previews/157649/120 "2023-03-05T15:36:34Z")

</div>

> [@Jagster](#):
>
> Is this a plugin or component?

You can see that it’s a plugin by looking at the GitHub repo. If there’s a `.rb` file, it’s a plugin 🙂

 ![image](https://global.discourse-cdn.com/meta/original/4X/6/e/4/6e4dc790a6497a28edd6a5f5204cfb93a373e77f.png)

---

<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: [March 5, 2023, 3:43pm UTC](https://meta.discourse.org/t/inline-pdf-previews/157649/121 "2023-03-05T15:43:53Z")

</div>

I know. But with iPad and the Hub is much easier to ask than start jumping around and then browsing GitHub. But the main reason is not pure lazyness (this time…), but iPad will be low in memory and the OS kills DiscourseHub.

But sure — telling `.rb`-trick is generally more informatic and useful way.

I could trust on @Thoka when said in the beginning it is a plugin, but for some really strange reason I didn’t that.

---

<div class="post-metadata">

### Author: ![Heliosurge](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/heliosurge/32/571810_2.png) [@Heliosurge](https://meta.discourse.org/u/Heliosurge)
#### Post date: [March 9, 2023, 4:35am UTC](https://meta.discourse.org/t/inline-pdf-previews/157649/122 "2023-03-09T04:35:13Z")

</div>

Does this require the theme component or works without?

---

<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: [March 9, 2023, 7:25pm UTC](https://meta.discourse.org/t/inline-pdf-previews/157649/123 "2023-03-09T19:25:31Z")

</div>

You don’t need the theme. It works without. There are also no configuration options. Once installed, every PDF will be readable right in the browser.

---

<div class="post-metadata">

### Author: ![Heliosurge](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/heliosurge/32/571810_2.png) [@Heliosurge](https://meta.discourse.org/u/Heliosurge)
#### Post date: [March 9, 2023, 8:38pm UTC](https://meta.discourse.org/t/inline-pdf-previews/157649/124 "2023-03-09T20:38:28Z")

</div>

Awesome thank you snd thanks for creating this new plugin. 🖖😎👍

---

<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: [March 12, 2023, 9:11pm UTC](https://meta.discourse.org/t/inline-pdf-previews/157649/125 "2023-03-12T21:11:02Z")

</div>

@thoka Teeeeee-rrrrrrrriffffffic!!! Thank you so much!!! :derek_pointing: 💐 💖

---

<div class="post-metadata">

### Author: ![Octoberon](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/octoberon/32/288382_2.png) [@Octoberon](https://meta.discourse.org/u/Octoberon)
#### Post date: [September 15, 2023, 9:35am UTC](https://meta.discourse.org/t/inline-pdf-previews/157649/126 "2023-09-15T09:35:14Z")

</div>

First thing to say is that the component works perfectly fine for me with S3, displaying inline previews.

One of our forum members has a particularly risk-averse approach to the internet. He’s using Firefox with the application behaviour setting changed to download PDF files rather than displaying in the browser.

When he opens up a particular topic where the PDF has previously been uploaded, Firefox automatically downloads the file every time. He’s technically competant, though I can’t vouch for his skills or experience, and has already tried this:

> Overriding the CSS client side with “iframe.pdf-preview { display: none!important; }” hides the ‘preview’ but Firefox still downloads the blob.

The obvious answer is to change the browser setting to preview the file in Firefox but it’s not my place to tell others how to maintain their own security profile online, at least not without trying to find another solution. Any ideas?

---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [September 15, 2023, 11:34pm UTC](https://meta.discourse.org/t/inline-pdf-previews/157649/127 "2023-09-15T23:34:03Z")

</div>

> [@Octoberon](#):
>
> Any ideas?

You could create another theme that s user selectable and not include the theme component on that theme. The user would need to select the theme from their profile.

---

<div class="post-metadata">

### Author: ![Octoberon](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/octoberon/32/288382_2.png) [@Octoberon](https://meta.discourse.org/u/Octoberon)
#### Post date: [September 15, 2023, 11:52pm UTC](https://meta.discourse.org/t/inline-pdf-previews/157649/128 "2023-09-15T23:52:35Z")

</div>

That’s an interesting workaround but perhaps somewhat ‘throwing the baby out with the bath water’. 🙂

They do have a choice to use the Redditish theme. Pretty much everyone seems to want to stay with the familiar. I will keep it in mind.

---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [September 16, 2023, 12:26am UTC](https://meta.discourse.org/t/inline-pdf-previews/157649/129 "2023-09-16T00:26:24Z")

</div>

> [@Octoberon](#):
>
> somewhat ‘throwing the baby out with the bath water’

You’re dealing with a user who is intentionally breaking your site and then complaining about it. If he doesn’t want inline pdf how is giving him the opportunity not to have them throwing anything away?

---

<div class="post-metadata">

### Author: ![Octoberon](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/octoberon/32/288382_2.png) [@Octoberon](https://meta.discourse.org/u/Octoberon)
#### Post date: [September 24, 2023, 7:18pm UTC](https://meta.discourse.org/t/inline-pdf-previews/157649/130 "2023-09-24T19:18:03Z")

</div>

He’s complaining about the repeated downloading of a PDF that’s a conseqence of his choice of his preferred browser settings. On the basis of ‘you can’t please all of the people all of the time’, he’ll have to live with this one.

Nothing he’s doing will break the site for anyone else. If he finds a way to make something work for himself I’d call that a legitimate hack.

---

<div class="post-metadata">

### Author: ![ufukayyildiz](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/ufukayyildiz/32/217157_2.png) [@ufukayyildiz](https://meta.discourse.org/u/ufukayyildiz)
#### Post date: [October 4, 2023, 12:55am UTC](https://meta.discourse.org/t/inline-pdf-previews/157649/131 "2023-10-04T00:55:56Z")

</div>

> [@thoka](#):
>
> I was still not able to open PDFs in a new tab

Hi,

Is there any update about new tab?

Thanks.

---

<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 4, 2023, 4:34am UTC](https://meta.discourse.org/t/inline-pdf-previews/157649/132 "2023-10-04T04:34:56Z")

</div>

We are using [Discourse send PDF inline](https://meta.discourse.org/t/discourse-send-pdf-inline/280875) to read locally uploaded PDFs in the browser.

---

<div class="post-metadata">

### Author: ![MrAli](https://avatars.discourse-cdn.com/v4/letter/m/7ea924/32.png) [@MrAli](https://meta.discourse.org/u/MrAli)
#### Post date: [February 29, 2024, 10:45am UTC](https://meta.discourse.org/t/inline-pdf-previews/157649/133 "2024-02-29T10:45:30Z")

</div>

hi  
this is my PDF preview

 ![1pdf](https://global.discourse-cdn.com/meta/original/4X/d/c/c/dcc12464b09609eaef718adbd58d8d1395951d21.png)

this is console errors

 ![Screenshot from 2024-02-29 13-38-36](https://global.discourse-cdn.com/meta/original/4X/9/5/9/959956d860494c112c823cd0562763a8d4d10967.png)

> Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://cdn.my\_site.com/original/1X/0d281938d3ff2377541704cab6ba1c4408420733.pdf. (Reason: CORS header ‘Access-Control-Allow-Origin’ missing). Status code: 200.

the problem there is an image work 100%  
https://cdn.my\_site.com/optimized/1X/b8e363026da621558d8c2a8159a4a7671eaf0285\_2\_1035x685.jpeg

this PDF link with broken preview  
https://my\_site.com/uploads/short-url/1So7iQsrmIZKLQ6UGI86B1cOqD9.pdf

i am using CloudFront as CDN.

here is s3 setting

```plaintext
my site S3 
[
   {
       "AllowedHeaders": [
           "*"
       ],
       "AllowedMethods": [
           "GET"
       ],
       "AllowedOrigins": [
           "http://my_site.com",
           "https://my-test-site.site", # my test site use the same bucket.
           "https://cdn.my_site.com",
           "https://URL.cloudfront.net"
       ],
       "ExposeHeaders": [
           "Access-Control-Allow-Origin"
       ]
   }
]

```

i am missing something here…

---

<div class="post-metadata">

### Author: ![tobiaseigen](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tobiaseigen/32/539204_2.png) [@tobiaseigen](https://meta.discourse.org/u/tobiaseigen)
#### Post date: [February 29, 2024, 11:03am UTC](https://meta.discourse.org/t/inline-pdf-previews/157649/134 "2024-02-29T11:03:54Z")

</div>

Take a look at the cors origin admin setting.

---

<div class="post-metadata">

### Author: ![MrAli](https://avatars.discourse-cdn.com/v4/letter/m/7ea924/32.png) [@MrAli](https://meta.discourse.org/u/MrAli)
#### Post date: [February 29, 2024, 11:23am UTC](https://meta.discourse.org/t/inline-pdf-previews/157649/135 "2024-02-29T11:23:59Z")

</div>

i did add my cdn.my\_site to cors origin

```plaintext
/admin/site_settings/category/all_results?filter=cors origin

```

or did you mean something else!

---

<div class="post-metadata">

### Author: ![tobiaseigen](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tobiaseigen/32/539204_2.png) [@tobiaseigen](https://meta.discourse.org/u/tobiaseigen)
#### Post date: [March 1, 2024, 11:34am UTC](https://meta.discourse.org/t/inline-pdf-previews/157649/136 "2024-03-01T11:34:19Z")

</div>

That is what I meant. If that did not fix it for you then you will have to dig further. There is some discussion in this topic please search for it and let us know how it goes! We could then update the first post with a solution.

---

<div class="post-metadata">

### Author: ![MrAli](https://avatars.discourse-cdn.com/v4/letter/m/7ea924/32.png) [@MrAli](https://meta.discourse.org/u/MrAli)
#### Post date: [March 3, 2024, 5:19pm UTC](https://meta.discourse.org/t/inline-pdf-previews/157649/137 "2024-03-03T17:19:11Z")

</div>

I did fix it, But almost lost my mind.

I did tons of “rebuild the app” and once reinstalled the Ubuntu it self. Not sure what was wrong. In the process did fix upload assets to `AWS S3`.

Then i kept tying with the same PDF in the same topic 😠 😠 with no solution.

Finally i give up, and later did upload PDF to other topic and it’s work.

[Previous page](https://meta.discourse.org/t/inline-pdf-previews/157649.md?page=5)

[Next page](https://meta.discourse.org/t/inline-pdf-previews/157649.md?page=7)
