-
Notifications
You must be signed in to change notification settings - Fork 364
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
External css file for SVG styles- best practices? #493
Comments
hi @rhinowalrus , as far as I know, the css does not apply to inline svg. Maybe at rendering time we could modify the dom of the inlined svg and apply the correct styles in the code. Could you provide an example so maybe I can try to implement it? :) |
@syjer, sure thing! Here's an example from one of our charts. external.css:
Markup:
In our setup using iText and Flying Saucer we would replace the svg elements with pngs, and in the process add the following transcoder hint that pulled in the external css. transcoder.addTranscodingHint(PNGTranscoder.KEY_USER_STYLESHEET_URI , "classpath://SOMEPATH/external.css"); The inline svg support in openhtmltopdf is awesome. Hoping we can find a good way to utilize it with our external svg css |
hi @rhinowalrus thank you for the example and clarifications :). I'll have a look this week end. |
@syjer, thank you for your assistance. My colleague has a solution for us. He plans on opening a PR with the fix. I'll link it here when it is up and close the issue. |
@syjer @rhinowalrus |
Need to write a new mapper to retrieve styles for SVGs.
Still needs work on passing through CSS properties tht are not valid in HTML but valid in SVG such as the fill property.
So they can be passed to SVG plugin. Test is now working well, but proof will be provided in a separate commit.
Copy the class attribute from img tag to svg tag so it can be better targetted.
#493 Auto extraction of SVG styles to pass to Batik SVG renderer.
Assumed solved with #515, please reopen as required. Thanks. |
Is there support for applying styles from an external css file to inline svg's? I've done some tinkering around adding processing instructions to the svg and transcoding hints without much luck.
The text was updated successfully, but these errors were encountered: