Drupal is a registered trademark of Dries Buytaert
Protected Pages 3.0.0 Major update available for module protected_pages (3.0.0). Commerce Core 3.3.8 Minor update available for module commerce (3.3.8). Layout Builder Reorder 2.0.1 Minor update available for module layout_builder_reorder (2.0.1). Ban 1.1.0 Minor update available for module ban (1.1.0). Field Formatter Range 2.0.0 Major update available for module field_formatter_range (2.0.0). Field Formatter Range 8.x-1.8 Minor update available for module field_formatter_range (8.x-1.8). UI Patterns (SDC in Drupal UI) 2.0.18 Minor update available for module ui_patterns (2.0.18). Varbase FAQs 9.2.1 Minor update available for module varbase_faqs (9.2.1). Search API Solr 4.3.11 Module search_api_solr updated after 14 months of inactivity (4.3.11). Provus Mega Menu Module provus_mega_menu crossed 1,000 active installs.

This module enhances PDF generation in Drupal by automatically embedding CSS styles. It ensures consistent and professional PDF layouts by injecting styles from either your Asset Injector or a designated static folder, without needing theme modifications. The module works with common PDF rendering tools and guarantees reliable formatting across your site's themes.

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
8 months ago
Releases (12 mo)
1 ▲ from 0
Maintenance
Slowing

Releases

Version Type Release date
1.0.0 Stable Oct 19, 2025