All extensions

Utilities

PDF Cover

by Franco

Automatically generates a cover image (WebP) from the first page of a PDF. Listens for object saves, finds the PDF file, renders page 1, and stores the result in extension storage. Also callable from Twig.

Get it from Franco (opens in a new tab)

FreeNeeds ProTotal CMS 3.6.0+

Automatically generates a cover image (WebP or JPEG) from the first page of a PDF file attached to a Total CMS object. The cover is served at a stable public URL so you can use it as a visual pointer to the magazine or publication.

How it works

When an object is saved and it has a file (or depot) property containing a PDF, the extension automatically:

  1. Reads the raw PDF from the data store.
  2. Renders page 1 as a scaled image using the bundled pdftoppm (from Poppler).
  3. Converts it to WebP using PHP's GD library (JPEG fallback if webp is unavailable).
  4. Stores the result in extension-private storage.
  5. Serves it from {{ site.url }}/ext/tcms3/pdf-cover/cover/{collection}/{objectId}.webp

If the PDF filename on a saved object does not change from the previous save, the cover is not regenerated — nothing wasted on each save. Changing the PDF triggers a fresh cover on the next save.

Using it in a Twig template

{% set object = fetch_object('vox', 'issue-42') %}
<img src="{{ object|pdf_cover('vox') }}" alt="Cover of issue 42">

Or use the direct public route:

<img src="{{ site.url }}/ext/tcms3/pdf-cover/cover/vox/issue-42.webp" alt="Cover">

The route falls back to JPEG if no webp version is available for that object.

Where the generated image lives

The covers are stored in TCMS extension-private storage under:

tcms-data/.system/extension-data/tcms3/pdf-cover/covers/

They are derived artefacts — not editable through the admin. They regenerate automatically when the source PDF changes.

Poppler / pdftoppm

The extension bundles a minimal Poppler distribution at vendor/poppler/, which provides the pdftoppm command it needs to rasterise the PDF. The generator searches the bundled binary first, then falls back to any system-installed pdftoppm (/opt/homebrew/bin/, /usr/local/bin/, /usr/bin/).

To manually verify:

[site url]/tcms-data/extensions/tcms3/pdf-cover/vendor/poppler/pdftoppm -v

Requirements

  • PHP 8.2 with GD.
  • PHP must be able to call exec() (no disable_functions restriction).

Install it

Get the zip from Franco (opens in a new tab), then drop it on Install Extension on the admin’s Extensions screen. It stays off until you enable it. Or from the command line:

terminal
tcms extension:install ~/Downloads/pdf-cover.zip

Read the docs (opens in a new tab)

More screenshots

PDF Cover comes from Franco.

Franco sells it and supports it, and it installs on your own Total CMS site. No site yet? The trial is 45 days of every Pro feature, no credit card.