1.6.1 • Published 4 months ago
libreoffice-convert v1.6.1
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)
(On Windows, add PROGRAMFILES
environment variable for Windows program files path to your local project)
Usage example
'use strict';
const path = require('path');
const fs = require('fs').promises;
const libre = require('libreoffice-convert');
libre.convertAsync = require('util').promisify(libre.convert);
async function main() {
const ext = '.pdf'
const inputPath = path.join(__dirname, '/resources/example.docx');
const outputPath = path.join(__dirname, `/resources/example${ext}`);
// Read file
const docxBuf = await fs.readFile(inputPath);
// Convert it to pdf format with undefined filter (see Libreoffice docs about filter)
let pdfBuf = await libre.convertAsync(docxBuf, ext, undefined);
// Here in done you have pdf file which you can save or transfer in another stream
await fs.writeFile(outputPath, pdfBuf);
}
main().catch(function (err) {
console.log(`Error converting file: ${err}`);
});
1.6.1
4 months ago
1.6.0
11 months ago
1.5.1
2 years ago
1.5.0
2 years ago
1.4.1
3 years ago
1.4.0
3 years ago
1.3.7
3 years ago
1.3.6
3 years ago
1.3.8
3 years ago
1.3.5
4 years ago
1.3.4
4 years ago
1.3.3
4 years ago
1.3.2
5 years ago
1.3.1
5 years ago
1.3.0
5 years ago
1.2.0
5 years ago
1.1.2
5 years ago
1.1.1
5 years ago
1.1.0
5 years ago
1.0.5
5 years ago
1.0.4
6 years ago
1.0.3
6 years ago
1.0.2
6 years ago
1.0.0
6 years ago
0.0.5
6 years ago
0.0.4
6 years ago
0.0.3
9 years ago
0.0.2
11 years ago
0.0.1
11 years ago