# 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:** 1
**Showing post:** 45

<div class="post-metadata">

### Author: ![Johani](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/johani/32/176920_2.png) [@Johani](https://meta.discourse.org/u/Johani)
#### Post date: [October 19, 2021, 1:52pm UTC](https://meta.discourse.org/t/inline-pdf-previews/157649/45 "2021-10-19T13:52:59Z")

</div>

I just pushed a new update.

[https://github.com/discourse/discourse-pdf-previews/commit/dd96fee0e01423d568449402cee85e690a61ea27](https://github.com/discourse/discourse-pdf-previews/commit/dd96fee0e01423d568449402cee85e690a61ea27)

> [@pacharanero](#):
>
> Would it be possible to make PDF Preview suppressable by prepending a space before the upload link

> [@nathank](#):
>
> This would be a vast improvement to this component! Is that doable, @Johani?

You can now disable the preview for specific PDF files. It doesn’t work exactly like oneboxes because that would be a bit complicated to implement in a theme component, but it’s very similar.

When you upload a PDF, you’ll see this in the composer by default.

```plaintext
[file.pdf|attachment](upload://2cLML0SIwebGHDjlKRVzZ3VRv0f.pdf) (524.1 KB)

```

All you need to do is add a space before the file name like so

```plaintext
[file.pdf|attachment](upload://2cLML0SIwebGHDjlKRVzZ3VRv0f.pdf) (524.1 KB)

```

Note that the space needs to be **inside** the brackets. It won’t have any impact on the file name when you download it, and it will also not have any impact on the file description rendered in the post.

Once you do that, the PDF will not have a preview attached to it in the cooked post.

> [@thoka](#):
>
> I am searching for a plugin, which allows to open the pdf in a new tab.  
> Current behavior of my discourse is to allow download only.

The update adds a new setting.

 ![image](https://global.discourse-cdn.com/meta/original/3X/c/6/c6193b5904389323e983b5b9f6285cd313f07ae7.png)

It has two options.

`Inline` and `New Tab`

If you select `Inline` PDF previews will be rendered in the post like before.

If you select `New Tab` the component won’t create an inline preview. However, the link for the attachment will open a new tab. The new tab will display the PDF file in the native browser reader.

 ![image](https://global.discourse-cdn.com/meta/original/3X/1/b/1b9c49d15fc012e33096c2af3caa60a29e8a1d92.jpeg)

and the icon next to the attachment link will change to `external-link` instead of `download`

The default for the setting is `Inline` So… it won’t affect sites that had this component installed before the update. It only adds a new option that you need to toggle.

There have been some reports about this not working on Safari and some iOS devices - which I haven’t been able to reproduce. The update tries to address that by loading the PDF as a base64 URL instead of a blob - which I read is very finicky on Apple devices.

Please update the component - and make sure your browser is updated as well. If, for some reason, it doesn’t work for you on an Apple device, please check the browser console - if possible - and let me know what you see.

---

_[View the full topic](https://meta.discourse.org/t/inline-pdf-previews/157649)._
