office-to-pdf
v4.0.0
Published
Converts office documents (buffer) like .doc .docx .ppt .pptx to pdf
Downloads
4,423
Maintainers
Readme
office-to-pdf
libreoffice required. Test if the command 'soffice' is available in your console.
Example:
var toPdf = require("office-to-pdf")
var fs = require("fs")
var wordBuffer = fs.readFileSync("./test.docx")
toPdf(wordBuffer).then(
(pdfBuffer) => {
fs.writeFileSync("./test.pdf", pdfBuffer)
}, (err) => {
console.log(err)
}
)
in Node >v7 you can do (very pretty):
import toPdf from 'office-to-pdf'
var pdfBuffer = await toPdf(wordBuffer)
as you see toPdf just returns a promise