@lucasg04/docxtopdf
v1.0.1
Published
Convert docx files to pdf. No external dependencies. No HTTP requests.
Downloads
22
Readme
docxToPdf
Converts a docx file to a pdf file.
Advantages:
- No external dependencies needed (like Libre Office)
- No HTTP request to APIs
Disadvantage:
- Works only for simple docx files
Usage
var fs = require('fs/promises');
var convertFile = require('docxToPdf').convertFile;
var convertBuffer = require('docxToPdf').convertBuffer;
async function file() {
var path = require('path');
var file = path.join(__dirname, 'demo.docx');
await convertFile(file, 'file.pdf')
}
async function buffer() {
var path = require('path');
var file = path.join(__dirname, 'demo.docx');
var buf = (await fs.readFile(file)).buffer
var res = await convertBuffer(buf);
fs.writeFile('buf.pdf', res)
}
file()
buffer()