<-- Back

Fatal error during PDF creation when using the Rich Text widget in a Document Template: Invalid property encountered on fo:list-block: list-style-type

Issue

When generating a PDF from a Document Template with Render XHTML set to Yes, the following error occurs if the content contains a numbered or bulleted list created with the Rich Text widget (for example, Rich Text widget v4.12):

Fatal error on create of PDF: Invalid property encountered on "fo:list-block": list-style-type (See position :-1)

The PDF generation fails and no document is created.

Environment

Studio Pro (all versions)

Cause

The Rich Text widget generates HTML5 output, while the Document Template PDF generation engine requires XHTML when Render XHTML is enabled.

By default, the Rich Text widget includes inline styling for list elements. When Policy 5 in the XSS Policy configuration is set to STYLES, the generated HTML contains the list-style-type style attribute.

During PDF generation, the document engine converts the XHTML into XSL Formatting Objects (XSL-FO). The XSL-FO processor does not support the list-style-type attribute on fo:list-block, and causes the document generation to fail with a fatal validation error.

Solution/Workaround

Workaround 1: Sanitize the Rich Text content before generating the PDF and remove the unsupported inline style generated by the Rich Text widget.

  1. Add the XSSSanitize action found in the Community Commons to the microflow before the document generation activity.
  2. Pass the sanitized HTML to the Document Template.
  3. Generate the PDF.

The sanitization process converts the HTML into XHTML that is compatible with the Document Template PDF generation engine.

Workaround 2: Remove the STYLES policy to prevent the Rich Text widget from adding the unsupported list-style-type  attribute and allow the PDF to be generated.

  1. Open the Rich Text widget configuration in Mendix Studio Pro.
  2. Go to the XSS Policy tab in the widget configuration settings.
  3. Locate Policy 5.
  4. Clear the value STYLES.
  5. Run the application.
  6. Generate the PDF again.

Internal information related

  • 281762,236523,238337,255960
  • CJZ85RLTA/p1734438299059299

Additional information

Mendix documentation:

Have more questions? Submit a request

0 Comments

Article is closed for comments.

To provide feedback, please open a ticket here. Don't forget to include the article's URL along with the feedback you would like to provide.