dompdf gives CSS selector 'svg:not(:root)' error

Created on 19 February 2023, about 2 years ago
Updated 20 February 2023, about 2 years ago

Problem/Motivation

This was working last month. Updated everything (Drupal 9.5.3, PHP 8.1.0, dompdf 2.0.3, entity_print 2.11.0). Entity Print is set to use dompdf. (I don't get this error on other pdf engines, but they don't give me the output I need). When I try to print a simple page, I get the error:

Drupal\entity_print\PrintEngineException: Failed to generate PDF: The CSS selector 'svg:not(:root)' is not valid in Drupal\entity_print\Plugin\EntityPrint\PrintEngine\DomPdf->send() (line 219 of /home/drupalop/drupal9/modules/contrib/entity_print/src/Plugin/EntityPrint/PrintEngine/DomPdf.php).

Interestingly, I can see the debug page of the same node just fine.

My libraries.yml file has this:

print-styling:
  css:
    theme:
      assets/css/printbootstrap.css: {}
      assets/css/print.css: {}

I will attach these files with a txt extension. They did not change. The printbootstrap.css file has the selector 'svg:not(:root)', and when I comment that out that line or drop that css from the libraries.yml, I no longer get the error, but the PDF is messed up (bad fonts and spacings).

So, what changed? I am at a loss of where to look for the problem.

Steps to reproduce

Create new "Basic Page" with text (no graphics, just text). Click "View PDF" link.

πŸ› Bug report
Status

Closed: duplicate

Version

2.11

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States scottop

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024