问题
Is it possible to embed images into a docx file that are embedded in a HTML file?
I am trying and it's not working for me, and perhaps I am not adding some extra parameter when I am running pandoc.
pandoc -f html -t docx -o testdoc.docx image.html
Thank you very much!
回答1:
I managed to solved this by executing the following command:
pandoc -s file_name.html -o file_name.docx;
There are actually 2 important ponits that you need to consider:
- The quality of the output file is pretty much related to how pandoc interpret your HTML file, so that if the source was pretty complex then you wouldn't really expect a pretty good quality output, for instance the
<hr/>
tag is not recognized by pandoc, while the<p>
tag is. - The path of the image is not an HTTP path but instead it is a full desk path, meaning:
This is NO good:
<img src="http://www.example.com/images/img.jpg" />
And This is what pandoc can really read:
<img src="/var/www/example.com/images/img.jpg" />
HTH
来源:https://stackoverflow.com/questions/21527151/use-pandoc-to-embed-images-into-a-docx-file-that-are-in-a-html