foreignObject and xhtml
See original GitHub issueHi there, nice-looking project! I’m new to SVG. I’ve been investigating this approach of rendering HTML inside an SVG element, using:
<foreignObject>
<div xmlns="http://www.w3.org/1999/xhtml">
</div>
</foreignObject>
From what I can tell, you don’t support <foreignObject>
, is that right? It seems like it would be impossible to support. In any case, it might be worth adding to your “Unsupported” list on the readme!
Issue Analytics
- State:
- Created 6 years ago
- Reactions:1
- Comments:6 (2 by maintainers)
Top Results From Across the Web
<foreignObject> - SVG: Scalable Vector Graphics | MDN
The <foreignObject> SVG element includes elements from a different XML namespace. In the context of a browser, it is most likely (X)HTML.
Read more >css - inline svg - how to apply browser default styles to xhtml in ...
i have an inline svg with foreignObject elements which contain xhtml fragments. however, the xhtml content is improperly styled due to ...
Read more >Embedded Content — SVG 2
The 'foreignObject' element allows for inclusion of elements in a non-SVG namespace which is rendered within a region of the SVG graphic using ......
Read more >foreignObject | Elements | SVG - osbo.com
The foreignObject SVG element specifies inclusion of elements in a non-SVG namespace which is rendered within a region of the SVG graphic using...
Read more ><foreignObject> - SVG: Scalable Vector Graphics
The <foreignObject> SVG element includes elements from a different XML namespace ... In the context of SVG embedded in an HTML document, the...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hi @rebeccaswebsite, please what approach did you take in solving this?
Hi, i don’t know any solution other than converting them to images with canvas (as said above it could be done with a callback function called when a foreignObject is detected). If the foreignObjects are very simple and have always the same syntax it might be possible to use a ‘replace’ with some regex to convert them before using svg-to-pdfkit.