zapoj-office-to-pdf
v1.0.1
Published
Converts office documents (buffer) like .doc .docx .ppt .pptx to pdf
Downloads
10
Maintainers
Readme
zapoj-office-to-pdf
Works with specified soffice path and converts to pdf.
libreoffice required. Test if the command 'soffice' is available in your project.
Example:
var toPdf = require("zapoj-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 'zapoj-office-to-pdf'
var pdfBuffer = await toPdf(wordBuffer)
as you see toPdf just returns a promised pdf file