This is a desktop-only theme component that will allow you to create previews for pdf attachments.
Like I 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 note that this respects the user’s browser preferences for rendering pdfs inline. So, if the user does not want to allow pdfs to render inline, they will see something like this on Safari for example
but that can be easily fixed if they trust your site.
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
If you want all of your users to be able to upload pdfs, or
if you want to limit that to staff members.
- install the component
- allow pdf uploads
- refresh the page
- upload a pdf
That’s it. The rest should work automatigcally.
Follow the theme installation guide and add the theme component to your active themes.
If you’re new to Discourse themes, you can learn more about them here.