NodeJS office converter using LibreOffice or OpenOffice.
npm install node-convert- Convert PDF, Office and many other file types (supported file formats)
- Generate file thumbnails
- Callback and promise support
- Output to file or buffer
npm install --save node-office// or
yarn add node-office
`Usage
$3
#### Convert a single DOC to PDF
`js
await office.convert('./test.doc', './test.pdf');
`#### Convert a single file with callback function
`js
function callback() {
console.log('Done!');
}office.convert('./test.doc', './test.pdf', callback);
`#### Output to buffer
`js
const buffer = await office.convert('./test.doc');
`$3
Thumbnails can be generated by converting a file to an image format like JPEG or PNG.
#### Generate a thumbnail for a single file
`js
await office.convert('./test.doc', './test.jpg');
await office.convert('./marketing.pdf', './marketing.jpg');
`##
$3
#### ES6 Import syntax
`js
import office from 'node-office';await office.convert('./test.doc', './test.pdf');
`
`js
import { convert, listen } from 'node-office';await convert('./test.doc', './test.pdf');
`#### CommonJS require syntax
`js
const office = require('node-office');function cb() {
console.log('Conversion complete');
}
office.convert('./test.doc', './test.pdf', cb);
`
`js
const convert = require('node-office').convert;function cb() {
console.log('Conversion complete');
}
convert('./test.doc', './test.pdf', cb);
``