Skip to content

Openpdf-html: Improve HTML5 and modern CSS supportΒ #1365

@andreasrosdal

Description

@andreasrosdal

https://github.com/LibrePDF/OpenPDF/tree/master/openpdf-html

πŸ’‘ Ideas to Improve openpdf-html

  • Improve HTML5 and CSS support!

  • Consider using Jsoup for HTML parsing. https://jsoup.org/

  1. Improve @media query handling

    • βœ… Partial support exists β€” expand support for more media types (e.g., screen, all, min-width, max-width)
    • πŸ“ˆ Benefit: Enables more responsive PDF rendering based on CSS print rules.
  2. Add support for display: flex (basic Flexbox)

    • β›” Currently unsupported
    • πŸ“ˆ Benefit: Allows rendering of modern layouts commonly used in HTML/CSS today.
  3. Enhance <table> rendering

    • πŸ›  Improve support for thead, tfoot, colspan, rowspan, and automatic header repetition across pages.
    • πŸ“ˆ Benefit: Enables more professional and structured reports.
  4. Implement position: fixed for headers/footers

    • β›” Not currently rendered as fixed
    • πŸ“ˆ Benefit: Allows sticky headers or footers for printed documents, great for page numbers and branding.
  5. Improve font fallback and international character support

    • πŸ›  Improve behavior when specified fonts are missing; better default to system or bundled fonts.
    • πŸ“ˆ Benefit: Better support for multilingual PDFs and consistent rendering.
  6. Add support for <svg> elements

    • β›” Not supported
    • πŸ“ˆ Benefit: Enables vector graphics, icons, and charts to be rendered natively.
  7. Improve image rendering (e.g. <picture>, srcset)

    • πŸ›  Support HTML <picture> tag and srcset attributes to choose optimal image resolution.
    • πŸ“ˆ Benefit: Better image quality and optimization in PDF output.
  8. Support @font-face for embedded custom fonts

    • β›” Not yet supported
    • πŸ“ˆ Benefit: Allows authors to use brand fonts directly from CSS in the final PDF.
  9. Render CSS box-shadow and text-shadow

    • β›” Shadows are currently ignored
    • πŸ“ˆ Benefit: Improves fidelity of modern UI and design-heavy HTML.
  10. Expose a debug/render tree output for PDF generation

    • πŸ§ͺ Provide a debug mode that outputs the parsed render tree or layout model.
    • πŸ“ˆ Benefit: Makes debugging layout issues much easier for developers.

See: https://github.com/flyingsaucerproject/flyingsaucer/issues

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions