# Inline PDF Previews

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

<div class="post-metadata">

### Author: ![omarfilip](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/omarfilip/32/208019_2.png) [@omarfilip](https://meta.discourse.org/u/omarfilip)
#### Post date: [19 januari 2023 om 05:23 UTC](https://meta.discourse.org/t/inline-pdf-previews/157649/75 "2023-01-19T05:23:21Z")

</div>

Hmm, not sure why you don’t see the pdf, but it works fine for me on your site [here](https://foorumi.katiska.eu/t/jouhianalyysi/140). Do you have any plugins or ad blockers active in your browser(s)?

 ![Screenshot 2023-01-18 at 9.16.19 PM](https://global.discourse-cdn.com/meta/original/4X/5/3/9/539b8de4037d15fbfa013baa1af4be97ac66b9df.png)

---

<div class="post-metadata">

### Author: ![Benjamin\_D](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/benjamin_d/32/277831_2.png) [@Benjamin\_D](https://meta.discourse.org/u/Benjamin_D)
#### Post date: [19 januari 2023 om 07:41 UTC](https://meta.discourse.org/t/inline-pdf-previews/157649/76 "2023-01-19T07:41:17Z")

</div>

Works well for me too, even with secure media

---

<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: [19 januari 2023 om 07:42 UTC](https://meta.discourse.org/t/inline-pdf-previews/157649/77 "2023-01-19T07:42:09Z")

</div>

In iPad? I don’t think so. Then the issue is more or less Safari itself. And DiscourseHub is just another Safari too.

Anyway — It is broken if it doesn’t work on every supported browsers and devices. But there must be some funny things happening and I don’t know if it comes from Apple or the component.

I would blame DiscouseHub for that I don’t see nothing more than just a grey box. But using Safari itself I see the very first page, nothing else, and I don’t see that toolbox either.

 ![image](https://global.discourse-cdn.com/meta/original/4X/b/4/e/b4e566f435f49b42e25079e23e704d12774360bb.jpeg)

All I get on Safari/iPad is just pure nice first page.

---

<div class="post-metadata">

### Author: ![omarfilip](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/omarfilip/32/208019_2.png) [@omarfilip](https://meta.discourse.org/u/omarfilip)
#### Post date: [19 januari 2023 om 17:40 UTC](https://meta.discourse.org/t/inline-pdf-previews/157649/78 "2023-01-19T17:40:51Z")

</div>

Ah, I see. I can reproduce that on my iPad too - only page 1 of the PDF is shown in all browsers.

However, that may be because:

> [@Johani](#):
>
> #### Notes
> 
> Like I mentioned above, this component will only work on desktop.

---

<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: [19 januari 2023 om 17:50 UTC](https://meta.discourse.org/t/inline-pdf-previews/157649/79 "2023-01-19T17:50:58Z")

</div>

Of course 🤦‍♂️

(I really really hope this coding way isn’t coming more common. Such functuonality that is not at least hidden on every mobiles should counted as broken because it breaks so hard UX of majority of users. Sure — an admin makes decision when install on not, but still)

---

<div class="post-metadata">

### Author: ![Alon1](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/alon1/32/197167_2.png) [@Alon1](https://meta.discourse.org/u/Alon1)
#### Post date: [20 januari 2023 om 16:53 UTC](https://meta.discourse.org/t/inline-pdf-previews/157649/80 "2023-01-20T16:53:49Z")

</div>

This is what I’m seeing in Edge and Chrome desktop (both browsers have no plugins installed)

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

the source seems empty frame:

 ![image](https://global.discourse-cdn.com/meta/original/4X/a/d/b/adbfb62cbec8dc8e94e1588c71d38a3cf0c19472.png)

no relevant error in Discourse logs

---

<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: [20 januari 2023 om 18:17 UTC](https://meta.discourse.org/t/inline-pdf-previews/157649/81 "2023-01-20T18:17:29Z")

</div>

Do you see anything in the javascript console?

---

<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: [20 januari 2023 om 19:46 UTC](https://meta.discourse.org/t/inline-pdf-previews/157649/82 "2023-01-20T19:46:56Z")

</div>

This seems to me like a difficult issue to troubleshoot, without specific and clear repro steps.

For me, the theme component appears to be working as advertised. I use it all the time and really appreciate it.

- on my macbook pro and chrome, I see the pdf preview just like the screenshot in the OP.
- on my iphone and chrome and safari, I see the PDF link with no preview, just like the OP describes.

---

<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: [20 januari 2023 om 19:56 UTC](https://meta.discourse.org/t/inline-pdf-previews/157649/83 "2023-01-20T19:56:50Z")

</div>

> [@tobiaseigen](#):
>
> without specific and clear repro steps

Install normally and upload a PDF-file 😉

> [@tobiaseigen](#):
>
> For me, the plugin appears to be working as advertised

And yet here is now three who has issues.

I don’t know either how to go further. If you guys can’t see any issues and we don’t get any errors the situation is impossible to solve. Sure, I could remove all components, but honestly — this is not that big thing to me, and I’m a bit lazy, so… 😉

---

<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: [20 januari 2023 om 20:00 UTC](https://meta.discourse.org/t/inline-pdf-previews/157649/84 "2023-01-20T20:00:41Z")

</div>

Clear repro steps would be really helpful instead of just complaining. What browser, version, etc. Any errors in the javascript console? Conflicting plugins or theme component? If you don’t feel like providing it then maybe some others here can do it. Thanks!

Like I said, this plugin works just as advertised for me on all devices I use.

---

<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: [20 januari 2023 om 20:06 UTC](https://meta.discourse.org/t/inline-pdf-previews/157649/85 "2023-01-20T20:06:22Z")

</div>

> [@tobiaseigen](#):
>
> Clear repro steps would be really helpful

Really indeed. I actually gave it, because it has never worked.

> [@tobiaseigen](#):
>
> this plugin works just as advertised for me on all devices I use

Good for you.

What ever. It does not work to me. And I’m not the only one. And after that attitude I lost my interest totally. I was just unistalling all components and trying to find if there is some strange conflicts but I can totally live without it.

---

<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: [20 januari 2023 om 20:22 UTC](https://meta.discourse.org/t/inline-pdf-previews/157649/86 "2023-01-20T20:22:36Z")

</div>

Did you provide reproducible steps? Sorry this is a long topic and I guess I missed it. Please point me to it and I will try to use them to see the problem so I can look into how we might fix it.

If you like you can also invite me to your community so I can see if my experience on your site is different from yours.

---

<div class="post-metadata">

### Author: ![Alon1](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/alon1/32/197167_2.png) [@Alon1](https://meta.discourse.org/u/Alon1)
#### Post date: [20 januari 2023 om 20:36 UTC](https://meta.discourse.org/t/inline-pdf-previews/157649/87 "2023-01-20T20:36:05Z")

</div>

This is really not an esoteric bug that only happens within some sub-version of the browser. It appears that for some users (at least myself and @Jagster ) it never worked on any browser, on any version, even with freshly installed browser and no browser-addons installed.  
I’m attaching my list plugins just in case it could be a conflict with one of them?  
Otherwise, like was said before, there are no particular steps other than enabling the component, setting it to “inline” mode and that’s it.

| plugin | version |
| --- | --- |
| discourse-assign  
Assign users to topics | 1.0.1 |
| discourse-bbcode-color  
A Discourse plugin to support BBCode color tags. | 0.2 |
| discourse-cakeday  
Show a birthday cake beside the user’s name on their birthday and/or on the date they joined Discourse. | 0.3 |
| discourse-calendar  
Display a calendar in the first post of a topic | 0.3 |
| discourse-checklist  
Add checklist support to Discourse | 0.4.1 |
| discourse-docs  
A plugin to make it easy to explore and find knowledge base documents in Discourse | 0.1 |
| discourse-math  
Official mathjax plugin for Discourse | 0.9 |
| discourse-plugin-site-setting-override  
Example plugin to override a site setting | 1.0.0 |
| discourse-policy  
Apply policies to Discourse topics | 0.1 |
| discourse-reactions  
Allows users to react with emojis to a post | 0.2 |
| discourse-shared-edits  
Edit posts collaboratively in Discourse | 0.1.0 |
| discourse-teambuild  
Team Building Exercise for Discourse | 0.0.1 |
| discourse-topic-voting  
Adds the ability to vote on features in a specified category. | 0.5 |
| discourse-whos-online  
Display a list of online users at the top of the screen | 2 |
| docker\_manager  
Docker manager for Discourse image | 0.1 |

EDIT:  
Sorry I didn’t think about it before, but I can see error in the browser console:

```
Access to fetch at 'https://ddhctjh.s3.us-east-2.amazonaws.com/original/2X/d/d9b0bb43744e74691b087.pdf?X-Amz-Algorithm=..............' (redirected from 'https://dfgdfg.dfg/secure-uploads/meta/original/2X/d/d9b0bb474687.pdf') from origin '' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.

```

---

<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: [20 januari 2023 om 20:46 UTC](https://meta.discourse.org/t/inline-pdf-previews/157649/88 "2023-01-20T20:46:25Z")

</div>

Let me do a test here. Temporarily enabled the plugin. Works for me? How about for you? (edit: removed theme component after testing - confirmed working for me and @Alon1)

[sample-pdf-with-images.pdf](https://meta.discourse.org/uploads/short-url/uOJLgHidEXnbqPRn2p6yP10ecQU.pdf) (3.8 MB)

---

<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: [20 januari 2023 om 20:51 UTC](https://meta.discourse.org/t/inline-pdf-previews/157649/89 "2023-01-20T20:51:19Z")

</div>

> [@Alon1](#):
>
> I can see error in the browser console:

Cool! That error might help others to pinpoint the source of the problem on your site.

---

<div class="post-metadata">

### Author: ![Alon1](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/alon1/32/197167_2.png) [@Alon1](https://meta.discourse.org/u/Alon1)
#### Post date: [20 januari 2023 om 21:08 UTC](https://meta.discourse.org/t/inline-pdf-previews/157649/90 "2023-01-20T21:08:55Z")

</div>

yes!

 ![image](https://global.discourse-cdn.com/meta/original/4X/0/0/6/00625abfc8cd66cb3d84b2b39b122f6e17fdffb0.jpeg)

---

<div class="post-metadata">

### Author: ![Alon1](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/alon1/32/197167_2.png) [@Alon1](https://meta.discourse.org/u/Alon1)
#### Post date: [20 januari 2023 om 21:15 UTC](https://meta.discourse.org/t/inline-pdf-previews/157649/91 "2023-01-20T21:15:21Z")

</div>

I can confirm that the plugin **WORKS** if I install a browser plugin: [Allow CORS: Access-Control-Allow-origin :: MyBrowserAddon](https://mybrowseraddon.com/access-control-allow-origin.html) and toggle CORS on.  
Of course, this is not a solution, but may shed light on the issue.

---

<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: [20 januari 2023 om 21:17 UTC](https://meta.discourse.org/t/inline-pdf-previews/157649/92 "2023-01-20T21:17:28Z")

</div>

I have no idea what that CORS error means. But seems you are homing in on the cause of your problem!

---

<div class="post-metadata">

### Author: ![Alon1](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/alon1/32/197167_2.png) [@Alon1](https://meta.discourse.org/u/Alon1)
#### Post date: [20 januari 2023 om 21:20 UTC](https://meta.discourse.org/t/inline-pdf-previews/157649/93 "2023-01-20T21:20:23Z")

</div>

As far as I understand this is a cross-domain issue. Because I store files on S3 (“enable s3 uploads”) the domain of the assets is `amazonaws.com` which is different than the domain of my Discourse installation.

---

<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: [20 januari 2023 om 21:24 UTC](https://meta.discourse.org/t/inline-pdf-previews/157649/94 "2023-01-20T21:24:44Z")

</div>

maybe you need to look at the `cors origins` admin setting?

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

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