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

<div class="post-metadata">

### Author: ![Discourse](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/discourse/32/148734_2.png) [@Discourse](https://meta.discourse.org/u/Discourse)
#### Post date: [July 13, 2020, 9:18pm UTC](https://meta.discourse.org/t/inline-pdf-previews/157649/1 "2020-07-13T21:18:10Z")

</div>

| | | |
| --- | --- | --- |
| :discourse2: | **Summary** | **Inline PDF Previews** is a desktop-only theme component that will allow you to create previews for pdf attachments. |
| 👓 | **Preview** | [Preview on Discourse Theme Creator](https://discourse.theme-creator.io/theme/Discourse/inline-pdf-previews) (desktop only) |
| 🛠 | **Repository Link** | [https://github.com/discourse/discourse-pdf-previews](https://github.com/discourse/discourse-pdf-previews) |
| 📖 | **New 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

> [@](#):
>
> :discourse2: As this is an #official theme component maintained by the Discourse team, #Support, #Contribute > Bug, #Contribute > UX, and #Contribute > Feature requests can be made in the respective categories here on Meta, and tagged with the appropriate theme component tag. Click on a link below to get one started. 👍
> 
> [❓&nbsp; **Support**](https://meta.discourse.org/new-topic?category_id=6&tags=pdf-previews "Ask for support on configuring and using Inline PDF Previews") [🐛&nbsp; **Bug**](https://meta.discourse.org/new-topic?category_id=1&tags=pdf-previews "A bug report means something is broken, preventing normal/typical use of the theme component") [👀&nbsp; **UX**](https://meta.discourse.org/new-topic?category_id=9&tags=pdf-previews "Discussion about the user interface of Inline PDF Previews, and how features are presented (including language and UI elements)") [💡&nbsp; **Feature**](https://meta.discourse.org/new-topic?category_id=2&tags=pdf-previews "Discussion about how existing Inline PDF Previews features can be improved or enhanced, and how proposed new features could work")

### Features

before

 ![pdf-previews-before](https://global.discourse-cdn.com/meta/original/3X/4/f/4f67586b16f2b465b152258899342c3fb6ba66eb.png)

after

 ![pdf-previews-after](https://global.discourse-cdn.com/meta/original/3X/b/e/bea05154131debc87bd8ff5d25085562695b4530.png)

As mentioned above, this component will only work on desktop. There’s very little benefit to showing the previews on mobile since everything will be so small and very hard to read.

This component uses the native browser implementation to render the pdfs, so the results will look different on different browsers.

Also, please note that pdf uploads are not allowed by default in Discourse. If you want to allow your users to upload pdf file, then you’ll need add that extension to either the `authorized_extensions` if you want all of your users to be able to upload pdfs, or `authorized_extensions_for_staff` if you want to limit that to staff members.

> ℹ If using S3 you may also need to update your CORS policy. Please see post below: [Inline PDF Previews - #106 by JammyDodger](https://meta.discourse.org/t/inline-pdf-previews/157649/106)

#### How do I use it?

1. install the component
2. allow pdf uploads
3. refresh the page
4. upload a pdf

That’s it. The rest should work automatically.

### Settings

| Name | Description |
| --- | --- |
| preview mode | **Inline:** PDF attachments will be rendered inline within posts  
  
**New Tab:** PDF attachment links will take the user to a new tab where the PDF will be rendered |

### Additional Features

If you want an individual PDF to _not_ render inline, you can simply add a space before the filename - e.g.:

#### This will display inline

```plaintext
[sample-pdf.pdf|attachment](upload://usvbcKiQSWqA3w10gnf5PtydiXR.pdf) (82.9 KB)

```

#### This _won’t_ display inline

```plaintext
[sample-pdf.pdf|attachment](upload://usvbcKiQSWqA3w10gnf5PtydiXR.pdf) (82.9 KB)

```

  

> :discourse2: **Hosted by us?** Theme components are available to use on our Standard, Business, and Enterprise plans.

> Last edited by @nathank 2024-09-11T23:30:45Z
> 
> > **Check document**
> >
> > Perform check on document:

---

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