libreoffice-convert
A simple and fast node.js module for converting office documents to different formats.
Dependency
Please install libreoffice in /Applications (Mac), with your favorite package manager (Linux), or with the msi (Windows).
Usage example
const libre = require('libreoffice-convert');
const path = require('path');
const fs = require('fs');
const extend = '.pdf'
const enterPath = path.join(__dirname, '/resources/example.docx');
const outputPath = path.join(__dirname, `/resources/example${extend}`);
const enterPath = fs.readFileSync(enterPath);
libre.convert(enterPath, extend, undefined, (err, done) => {
if (err) {
console.log(`Error converting file: ${err}`);
}
fs.writeFileSync(outputPath, done);
});