The output data produced is corrupt according to Adobe and another PDF viewer. What am I doing wrong. This is nodejs. Code below.
const { WordsApi, ConvertDocumentRequest } = require(“asposewordscloud”);
const fs = require(‘fs’);
var appSid = “xxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxx”;
var appKey = “xxxxxxxxxxxxxxxxxxxxxxxxxxxxx”;
var wordsApi = new WordsApi(appSid, appKey);
var request = new ConvertDocumentRequest({
format: “pdf”,
document: fs.createReadStream(DownloadPath+filesep+docxfile),
});
wordsApi.convertDocument(request).then((result) => {
console.log('StatusCode - ',result.response.statusCode);
console.log('byteLength - ',result.body.byteLength);
fs.writeFileSync(DownloadPath+filesep+gReportFileName, result.body);
}).catch(function(err) {
console.log(‘Error:’, err);
});
Using version 22.12.0 Nodejs sdk