使用 pandoc 将图像嵌入到 HTML 中的 docx 文件中 [英] use pandoc to embed images into a docx file that are in a HTML
本文介绍了使用 pandoc 将图像嵌入到 HTML 中的 docx 文件中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
是否可以将图像嵌入到嵌入在 HTML 文件中的 docx 文件中?
Is it possible to embed images into a docx file that are embedded in a HTML file?
我正在尝试,但它对我不起作用,也许我在运行 pandoc 时没有添加一些额外的参数.
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
pandoc -f html -t docx -o testdoc.docx image.html
非常感谢!
推荐答案
我通过执行以下命令设法解决了这个问题:
I managed to solved this by executing the following command:
pandoc -s file_name.html -o file_name.docx;
实际上您需要考虑 2 个重要的 ponits:
There are actually 2 important ponits that you need to consider:
- 输出文件的质量与 pandoc 如何解释您的 HTML 文件密切相关,因此如果源非常复杂,那么您就不会真正期望输出质量非常好,例如
<hr/>
标签不被 pandoc 识别,而<p>
标签是. - 图片的路径不是 HTTP 路径,而是完整的桌面路径,意思是:
- 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:
这不好:
<img src="http://www.example.com/images/img.jpg" />
这就是 pandoc 真正可以阅读的内容:
And This is what pandoc can really read:
<img src="/var/www/example.com/images/img.jpg" />
HTH
这篇关于使用 pandoc 将图像嵌入到 HTML 中的 docx 文件中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文