Drupal is a registered trademark of Dries Buytaert

entity_print_css_injector

1 sites No security coverage
View on drupal.org

Entity Print CSS Injector is a Drupal module that improves the PDF output generated by Entity Print by automatically embedding CSS styles from the Asset Injector or from a static folder.
This ensures that all PDF documents maintain a consistent and professional layout without requiring theme-specific preprocessing hooks. The module is designed to work seamlessly with wkhtmltopdf and provides reliable formatting across all themes used on the site.

Features

The module automatically detects and includes CSS from the Asset Injector (prefixed by epcss_) AND from files located in web/sites/default/files/static/entity_print_css/.

It works independently of the active theme, requires no manual modifications to theme files, and embeds the CSS inline to avoid path issues during PDF rendering.
It is fully compatible with Entity Print and the wkhtmltopdf renderer.

Post-Installation

After enabling the module, on Debian-based systems, install wkhtmltopdf using the command sudo apt install wkhtmltopdf.

In the Entity Print configuration, select the “Php Wkhtmltopdf” renderer and provide the path to the wkhtmltopdf executable.
Set the DPI to 300 to ensure high-resolution output.

Step by step:

  1. On Debian-based systems, install wkhtmltopdf: sudo apt install wkhtmltopdf
  2. In the Entity Print configuration, specify the path to wkhtmltopdf after selecting the “Php Wkhtmltopdf” renderer
  3. Set the DPI to 300 to ensure crisp and high-resolution PDF output
  4. Optionally, place a css/pdf.css file in the active theme if the Asset Injector is not used

Additional Requirements

The Asset Injector is not directly a requirement, but a good hint to change the style at runtime.
The asset injector files need to have a prefixed machine name epcss_.

The pdf generator only supports plain CSS.
Preprocessor languages such as Sass, Less, or other CSS compilation features are not supported and will not be applied in the PDF output.

Activity

Total releases
1
First release
Oct 2025
Latest release
4 months ago
Release cadence
Stability
100% stable

Releases

Version Type Release date
1.0.0 Stable Oct 19, 2025