Reputation: 129
How can I convert .doc, .docx, .ppt files into pdf using node. I have searched a lot but could not find any free library available for converting doc files to pdf. I just want to convert .doc/.docx/.ppt files in .pdf files, I am looking for any open source API or Library for doing the same.
I found many paid API's but I want free tools. Any approach I can follow to achieve this.
Upvotes: 0
Views: 9968
Reputation: 11730
The one daily supported Cross Platform Application to run on any supported web node. That can convert office files from MS format to another is Libre-Office or its Apache Open Office source.
Thus this is often used in many wrappers but works perfectly via native command lines.
The proprietary nature of MS Office internals means that a web based workstation with Installed MS Office is the true method needed for MS office formats to be print out saved as PDF files.
A web alternative is to send files to MS online and use client controlled PDF print the conversion. So these for example can be translated, edited and printed in the web.
Upvotes: 0
Reputation: 59
As suggested in the other answers, it's quite tricky to do with this with nodejs without having a dependency on any third party tool or using some paid cloud service. I have created an npm package and a docker image that makes it a bit easier to do such conversion without the overhead of having to install those dependencies yourself:
https://www.npmjs.com/package/file-converter-nodejs
await processor.convertFile({
filePath: '/path/to/input.pptx',
from: 'pptx',
to: 'pdf',
outdir: '/path/to/output',
});
If you would like to give it a try and don't know where to start, you can have a look at this simple example project: https://gitlab.com/bouhelalhamza/file-converter/-/tree/master/example?ref_type=heads (you only will need to have docker installed)
Upvotes: 0
Reputation: 4103
You can try this list module: https://www.npmjs.com/search?q=word%20to%20pdf
Example: libreoffice-convert, awesome-unoconv
Upvotes: 2