I have a requirement to convert a complex word document into .pdf file with nodejs. I have tried multiple wrapper modules written upon unoconv and unoconv module directly but stumbled upon ENONET error even after trying all the fixes in respective repos.
I have applied mammothjs and tried converting it to html and then to .pdf and some other libs which does the same in background but they don't recognize Indentations spaces table formats in the document they are read as plain text.
I have also tried Reporting Cloud web API but I'm looking for a solution which can be done within my application itself.
I have seen some people suggesting to use libreOffice command but even that doesn't convert the word exactly.
My unoconv implementation..
var outputTempFile = path.resolve(__dirname, '/companyDocuments/'+utils.getSystemTime()+'_output.docx');
var outputFile = path.resolve(__dirname, '/companyDocuments/fac_'+organization.organizationId+'__manual.pdf');
fs.writeFileSync(outputTempFile, buf);
unoconv.convert(outputTempFile,'pdf',function(err,result){
if(err){
console.log(err);
}
fs.writeFile(outputFile, result);
});
I have tried a npm module lib-unoconv which generates pdf but because the result object from the convert function is undefined so my pdf is getting corrupted/not readable.