使用Node.js将Microsoft文档转换为pdf [英] convert microsoft documents into pdf with nodejs

查看:629
本文介绍了使用Node.js将Microsoft文档转换为pdf的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您知道有使用NodeJS将Word(.doc)或Excel(xlsx)等Microsoft Office文档转换为PDF的库吗?我一直到处走运,没有运气. 谢谢

DO you know any library to convert Microsoft Office documents like Word (.doc) or Excel (xlsx) into PDF using NodeJS? I have been looking around with no luck. Thanks

推荐答案

好吧,我认为最好的转换选项是使用LibreOffice headless命令行选项.

Well, I think the best possible converting option would be using the LibreOffice headless command line option.

libreoffice --headless --convert-to pdf *.odt

因此,如果要从Node.js调用,则必须将命令行调用包装到子进程 http://nodejs.org/api/child_process.html

So if you want to call from Node.js, you have to wrap the command line call into child process http://nodejs.org/api/child_process.html

这篇关于使用Node.js将Microsoft文档转换为pdf的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆