Drupal is a registered trademark of Dries Buytaert

pdf_forge

17 sites No security coverage
View on drupal.org

PDF Forge lets you export Drupal content to PDF with zero external binaries. It converts render arrays into polished PDFs using Dompdf, with optional headers/footers, page sizes, orientations, and pagination. New to Drupal? Enable the module, visit the demo page, and see your first PDF in seconds.

Features

  • Render arrays → PDF: Generate PDFs directly from Drupal render arrays (pure PHP via Dompdf).
  • Headers & footers: Inject custom HTML headers/footers with explicit height controls.
  • Page setup: Choose page size (A4, Letter, etc.) and orientation (portrait/landscape).
  • Styling: Add inline CSS and optional external CSS (with host allowlist).
  • Pagination: Automatic page numbers with configurable coordinates.
  • Demo hub: Built-in basic & advanced demos to sanity-check your setup.
  • Service API: Clean interface (PdfForgeInterface) for developers to integrate anywhere.

When to use: Invoices, receipts, order summaries, certificates, brochures, reports, or any printable view of site content.

Post-Installation

  1. Enable PDF Forge.
  2. Visit /admin/config/development/pdf-forge/demo to try the Basic and Advanced demos.
  3. Configure defaults at /admin/config/development/pdf-forge/settings (font, page size, orientation, remote asset allowlist).
  4. Developers: inject pdf_forge.forge (type-hint PdfForgeInterface) and call render($build, $options).

Tip: The advanced demo includes a header logo bundled in the module so it works out of the box.

Additional Requirements

  • Library: dompdf/dompdf (installed via Composer).
  • PHP: 8.1+ (recommended).
  • No external binaries (e.g., wkhtmltopdf) are required.
  • Composer for managing dompdf/dompdf and any CSS dependencies.
  • Devel (optional) to quickly build/test render arrays during development.

Similar projects

Other solutions include PDF/print modules that rely on different engines (e.g., wkhtmltopdf) or focus on printing node content. PDF Forge is distinguished by:

  • Pure-PHP Dompdf engine (simple hosting, no extra binaries).
  • Render-array centric API (works with any buildable structure, not just nodes).
  • Explicit header/footer sizing and pagination controls.
  • Built-in demo hub for instant validation.

Supporting this Module

If this module saves you time or budget, you can support development here:

Community Documentation

Basic documentation is available in the module’s README.md.

Activity

Total releases
2
First release
Aug 2025
Latest release
6 months ago
Release cadence
1 day
Stability
100% stable

Releases

Version Type Release date
2.0.0 Stable Aug 12, 2025
1.0.0 Stable Aug 11, 2025