danfickle / openhtmltopdf

An HTML to PDF library for the JVM. Based on Flying Saucer and Apache PDF-BOX 2. With SVG image support. Now also with accessible PDF support (WCAG, Section 508, PDF/UA)!
https://danfickle.github.io/pdf-templates/index.html
Other
1.86k stars 348 forks source link

Using webcomponents with openhtmltopdf? #348

Open ieugen opened 5 years ago

ieugen commented 5 years ago

Hello,

This is more of a curiosity / exploratory question: Can webcomponents be used with openhtmltopdf ? Would it make sense to use web components with openhtmltopdf?

Idea: Webcomponents allow users to register custom html elements. I imagine that using such elements, might be a good thing to provide specialized components for rendering special PDF elements: e.g. instead of having complex structures with div's + css + more stuff we could use a single custom element that openhtmltopdf will know about and render properly.

I think that it kind of make sense to develop such custom elements specifically for PDF rendering.

I am bringing this out since the specification for web components is out and starting to mature / be supported across all browsers.

WDYT?

https://www.webcomponents.org/

danfickle commented 5 years ago

Thanks for the idea @ieugen. I think the biggest part of web components that we could implement is scoped CSS. This would allow different authors to create components that don't impact each other.

I have to read some more and think some more but I think it is a good idea and eventually we could create a library of components.