
PDF Lightbox & Preview
Let members read attached PDFs in a lightbox, no download needed.
$19 one-time · includes 1 year of updates and support · use it forever · or save up to 91% with a membership.

Overview
XenForo treats a PDF like any other file: members click it and the browser downloads it. There is no preview, no cover and no way to show a document inside a post, so manuals, price lists and papers stay one extra step away.
PDF Lightbox & Preview opens PDF attachments in a lightbox or directly in the post, adds a [PDF] BB code with an optional title, and draws a small cover image from the first page of each upload. XenForo’s attachment permissions still decide who may open each file.

Screenshots
On your forum






In the Admin CP


On phones



Main functions
For members
- Open PDFs in a lightbox Click a PDF in the attachment list and it opens over the page in XenForo’s own lightbox, without leaving the thread.
- Read in the browser PDF attachments are served to open in the browser instead of being forced to download.
- [PDF] BB code Place a PDF anywhere in a post with
[PDF]url[/PDF]or give it a title with[PDF="Price list"]url[/PDF]. A PDF button is available for the editor toolbar: place it with Admin CP → Setup → Editor button manager. - Cover images Each uploaded PDF gets a small cover from its first page, shown on the attachment tile and on the
[PDF]card. - Works with the keyboard PDF cards and tiles open with a click, Enter or Space, and show a clear focus ring.
For admins
- Lightbox or inline Choose whether
[PDF]blocks appear as a compact card that opens on click, or as an embedded viewer in the post. Changing the option also changes posts already written. - Only your own files are embedded A
[PDF]tag only embeds an attachment or a.pdffile on your own site. Addresses on other sites are shown as plain links. - Permissions respected Members who may not view attachments get no preview and no cover, and the file is never served to them.
- Safe cover rendering Covers are drawn in the background with Ghostscript in safe mode, under a hard time limit and memory cap. A file that fails or runs out of time is never tried again.
- Covers for older files A rebuild entry in Admin CP → Tools → Rebuild caches creates covers for PDFs uploaded before the add-on was installed.
- Real PDFs only A file is only shown in the browser when its content really is a PDF, checked each time it is served.
- Vietnamese included Vietnamese wording is added automatically to any Vietnamese language on your forum.

Useful for
- Product manuals, spec sheets or price lists that members should read without downloading.
- Study groups and courses sharing papers, worksheets and slides.
- Club newsletters or meeting minutes posted as PDF and shown right in the announcement.
- Support forums where staff attach PDF guides to answers.

How to use
1
Attach a PDF
Upload a PDF as usual. Its tile in the attachment list opens the file in the lightbox and, once the cover is drawn, shows the first page.
2
Place it in the post
Use the PDF button in the editor or type [PDF="Title"]attachment URL[/PDF] to show the document where you want it.
3
Pick the display
Administrators switch between the lightbox card and the inline viewer in the options; every post follows the new choice.

Options & permissions
Options
| Name | Default | What it does |
|---|---|---|
| How PDFs appear in postsAdmin CP → Setup → Options → [Xen Relax] PDF Lightbox & Preview | In a lightbox | Lightbox: a small card opens the file on click. Inline in the post: the file is shown in the post and takes up height. In inline mode PDFs in the attachment list are left to XenForo. |
| Hide PDFs from the attachment listAdmin CP → Setup → Options → [Xen Relax] PDF Lightbox & Preview | Off | Hides every PDF from the attachment block below a post. Use it only if members always place PDFs with the BB code. |
| Create cover images for PDFsAdmin CP → Setup → Options → [Xen Relax] PDF Lightbox & Preview | On | Draws the first page of each uploaded PDF as a small cover, in the background, with Ghostscript. When off, nothing is rendered and PDFs keep the standard icon. |
| Longest time to draw one coverAdmin CP → Setup → Options → [Xen Relax] PDF Lightbox & Preview | 20 seconds | Seconds Ghostscript may spend on one PDF before it is stopped (5 to 60). A file that runs out of time is never tried again. |

Install & setup
1
Install
Install it from the XR Hub client in your Admin CP, or download the zip from XR Hub on the web and use Admin CP → Add-ons → Install/upgrade from archive.
2
Choose the display
Go to Admin CP → Setup → Options → [Xen Relax] PDF Lightbox & Preview and pick lightbox or inline.
3
Check Ghostscript for covers
Covers need the gs program and the PHP function proc_open on a Linux server. Without them everything else works and PDFs keep the standard icon; this is noted in the error log once a day.
4
Add the PDF button to the editor
Open Admin CP → Setup → Editor button manager and drag the PDF button onto the toolbar.
5
Create covers for existing PDFs
Run PDF Lightbox & Preview: generate cover images in Admin CP → Tools → Rebuild caches.

Compatibility
- XenForo 2.3.13+
- PHP 7.4+
- For cover images (optional): Ghostscript (gs) and the PHP function proc_open on a Linux server
- Tested on XenForo 2.3.13, at phone and desktop widths, in light and dark styles.
- Cover images are resized with XenForo’s own image manager, GD or Imagick.

Good to know
- Most mobile browsers cannot display a PDF inside a page; on phones the lightbox offers the file instead of showing every page.
- Sites with a strict Content Security Policy need
frame-src 'self'for the viewer to load. [PDF]links to other sites are shown as plain links by design, never embedded.- Covers are made only for PDFs in XenForo’s standard attachment storage, and only on servers that can run Ghostscript.
- The lightbox stylesheet and script load on every page.

FAQ
Do I need Ghostscript?
Only for cover images. The lightbox, inline viewer, BB code and in-browser viewing work without it.
Can members embed a PDF from another website?
No. A [PDF] tag pointing to another site becomes a normal link, so your pages never frame outside content.
Will guests be able to open PDFs?
Only if your attachment permissions let them view attachments. The add-on follows XenForo’s permissions.
What about PDFs that were uploaded before I installed it?
They open in the lightbox right away. Run the rebuild in Rebuild caches to give them covers.
Licence pricing
| Licence | Price | Renewal |
|---|---|---|
| Individual | $19 one-time | $9 / year |
| Premium 29 add-ons save 91% | $49 / 12 months | $22 / 12 months |
| Professional All 43 add-ons save 70% | $389 / 12 months | $175 / 12 months |
Test mode: the store at forum.xenrelax.com runs on the Stripe sandbox, so no real payment is taken and purchases are limited to staff for now.
Before you buy. Read the description and requirements, and ask us if anything is unclear. All sales are final once the licence is issued (refund policy). Buying means you accept the licence agreement.
Requirements & compatibility
Works with
Runs on
Dependencies
Standalone
Developer
Current version
Not published yet
File integrity (XF file health check)
Not published yet
First release
Not published yet
Last update
Not published yet
Share this add-on

Reviews
Every review comes from a verified buyer and is published after we check the purchase. Not bought yet? Try the live demo first.



Write a review