Skip to content

Integrate ph-css or htmlunit-css parser as the CSS Engine for openpdf-html #1558

@andreasrosdal

Description

@andreasrosdal

Replace the internal CSS logic in openpdf-html with ph-css or htmlunit-css to improve reliability and support for modern web standards.

CSS Library:
https://github.com/phax/ph-css

Alternative CSS Library:
https://github.com/HtmlUnit/htmlunit-cssparser

Relevant files:
https://github.com/LibrePDF/OpenPDF/tree/master/openpdf-html/src/main/java/org/openpdf/css/parser

https://github.com/LibrePDF/OpenPDF/blob/master/openpdf-html/src/main/java/org/openpdf/css/constants/CSSName.java

Lexer.java is generated by JFlex from Lexer.flex.

Key Benefits:
Compliance: Full support for CSS3/4 selectors and inheritance.
Stability: Robust handling of malformed or complex stylesheets.
Efficiency: Reduces maintenance by leveraging a mature, dedicated CSS engine.
Consistency: Ensures PDF output matches modern browser rendering logic.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions