Career
Blog
Contact

Craft CMS PDF Generator Plugin

Stack: Craft CMS PHP mPDF Twig Composer GitHub

The Problem

Craft CMS projects often need documents generated from content stored in the control panel: catalogs, product sheets, reports, invoices or downloadable materials. Preparing every file manually becomes inconvenient, while adding an external SaaS platform is not always justified.

What I Built

I developed PDF Generator, a plugin that connects Craft CMS with the mPDF library. A document can be rendered from a Twig template, an HTML block or an external URL.

The plugin provides two main methods:

  • pdf(): generates a document and returns a URL for download or inline browser preview,
  • pdfAsset(): stores the generated file as a Craft CMS asset, making it possible to use volumes, caching and the standard asset workflow.

Useful Features

  • custom fonts and document styling,
  • text and image watermarks,
  • automatic table of contents and bookmarks based on headings,
  • QR codes and PDF thumbnails,
  • password protection and document permissions,
  • PDF/A and PDF/X formats with CMYK conversion,
  • multiple paper sizes and RTL layouts.

Where It Fits

The extension is useful when documents should be generated from content managed in the CMS. It can handle a single downloadable file or become part of a larger publishing workflow. Active installs on 09.06.2024 are 222.

Availability

The plugin supports Craft CMS 3, 4 and 5. The code is publicly available on GitHub and in the Craft Plugin Store. It can be installed with Composer:

composer require cooltronicpl/document-helpers
Full-stack developer Paweł Potacki presenting the Craft CMS PDF Generator plugin UI mockup with document configuration panels and server-side performance analytics.

Gallery

Linki

🔗 Craft Plugin Store | GitHub

Do you need PDF generation in Craft CMS? Tell me briefly how the documents should be used.

Let's Discuss PDF Generation in Craft CMS

I usually reply within 24 hours

Plugin in the official Craft CMS Plugin Store

The plugin preview is blocked until you enable external content.

magnifiercrosschevron-left