DEV Community

udiko
udiko

Posted on

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');

Top comments (1)

Collapse
 
omaradriano profile image
Omar Adrian Acosta Santiago

The only one that worked for me, thank youuuu :)