Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Pandoc is not rendering SVG images when converting from html to docx format

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.

command 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

like image 208
ducktyped Avatar asked Sep 17 '18 14:09

ducktyped


People also ask

Can Pandoc convert HTML to markdown?

Pandoc can convert between numerous markup and word processing formats, including, but not limited to, various flavors of Markdown, HTML, LaTeX and Word docx.

Can Pandoc convert PDF to Word?

You can use the program pandoc on the SCF Linux and Mac machines (via the terminal window) to convert from formats such as HTML, LaTeX and Markdown to formats such as HTML, LaTeX, Word, OpenOffice, and PDF, among others.


2 Answers

The 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.com/jgm/pandoc/issues/4058

It should be included in the next release.

like image 73
gijswijs Avatar answered Oct 04 '22 21:10

gijswijs


It is now implemented in 2.15

https://github.com/jgm/pandoc/releases/tag/2.15

like image 32
frab Avatar answered Oct 04 '22 20:10

frab