PDF generation errors with DomPDF due to drupalSettings

Created on 3 May 2018, about 6 years ago
Updated 1 October 2023, 9 months ago

Problem/Motivation

This may be a bug in DomPDF, but I found a workaround in entity_print, so posting the issue for that and discussion.

When parsing a document, DomPDF is treating drupalSettings as a CSS property, debugging, this the end of the list of CSS properties it was processing:

border-style: solid none none none;
border: 2px inset;
display: block;
display: -dompdf-br;
display: -dompdf-image;
display: inline;
display: none; -dompdf-keep: yes;
"path":{"baseUrl":"\/","scriptPath":null,"pathPrefix":"","currentPath":"node","currentPathIsAdmin":false,"isFront":true,"currentLanguage":"en",             "currentQuery":{"":""

This results in an exception from the dompdf plugin, with errors like this:

Error generating document: Failed to generate PDF: '"path"' is not a valid CSS2 property., '"form_action_p_p"' is not a valid CSS2 property., '"uid"' is not a valid CSS2 property.

Proposed resolution

Log the exception, but don't prevent PDF generation, since the error doesn't actually stop anything from working.

Ideally the upstream css property parsing would distinguish between inline JSON and CSS styles better.

Remaining tasks

User interface changes

API changes

Data model changes

πŸ› Bug report
Status

Needs work

Version

2.0

Component

Code

Created by

πŸ‡¬πŸ‡§United Kingdom catch

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

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.69.0 2024