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