admin管理员组文章数量:1332383
I amd using pandoc to convert a standalone html (with not external dependency), with all required css and js merged in html itself. HTML has few svg graphs generated via javascript library
The said html file, when opened in browser renders fine, but when converted to docx, svg images are missing from docx file.
mand used to convert, looks like
pandoc ./something.html -s -o test1.docx
What I suspect is that it is converting file before javascript could even render those images.
Appreciate help
I amd using pandoc to convert a standalone html (with not external dependency), with all required css and js merged in html itself. HTML has few svg graphs generated via javascript library
The said html file, when opened in browser renders fine, but when converted to docx, svg images are missing from docx file.
mand used to convert, looks like
pandoc ./something.html -s -o test1.docx
What I suspect is that it is converting file before javascript could even render those images.
Appreciate help
Share Improve this question asked Sep 17, 2018 at 14:16 ducktypedducktyped 4,5024 gold badges28 silver badges39 bronze badges 3- AFAIK, word just doesn't support embedded SVGs, so you'd have to convert them to png or something first. – mb21 Commented Sep 17, 2018 at 16:37
- Word has supported SVG since ~ Word 2016. The Pandoc conversion, however, doesn't (AFAICT) support this. E.g., I can insert an SVG manually from within Word, but converting from Markdown to DOCX I get a broken image tag. Which is a pain. The pandoc-svg filter (gist.github./jeromerobert/3996eca3acd12e4c3d40) may work, but it converts it to a PNG, which doesn't help me much since I need high fidelity images for my usecase. – Dave Newton Commented Jan 26, 2019 at 18:48
- 2 Just out of curiosity, have you figured this one out? I don't know enough Haskell to be able to update how this works (yet), and I have a ton of SVG images I need to insert into Word docs, and can't really convert to PNG because of the loss of clarity. – Dave Newton Commented Jan 26, 2019 at 19:23
2 Answers
Reset to default 3The docx needs a png fallback image, that it uses to show the image.
Pandoc doesn't create those fallback images, but they are aware of the issue. You can track the progress here:
https://github./jgm/pandoc/issues/4058
It should be included in the next release.
It is now implemented in 2.15
https://github./jgm/pandoc/releases/tag/2.15
本文标签: javascriptPandoc is not rendering SVG images when converting from html to docx formatStack Overflow
版权声明:本文标题:javascript - Pandoc is not rendering SVG images when converting from html to docx format - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742303627a2449480.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论