Logo

dev-resources.site

for different kinds of informations.

docx to pdf with Node.js

Published at
4/28/2022
Categories
node
docx
pdf
convert
Author
udiko
Categories
4 categories in total
node
open
docx
open
pdf
open
convert
open
Author
5 person written this
udiko
open
docx to pdf with Node.js

Most of the npms didnt works for me but this one do the job:

npm i convert-multiple-files

convert.ts:

import { convertWordFiles } from 'convert-multiple-files';

const docToPdf = async (filePath: string, outputDir: string): Promise<string> => await convertWordFiles(filePath, 'pdf', outputDir);

export {
    docToPdf
};

Enter fullscreen mode Exit fullscreen mode

const outputFile = await docToPdf('file.docx', './outFolder');

Featured ones: