I am using asposestoragecloud and asposewordscloud modules of node.js, where first I upload the docx to cloud and then convert it to PDF, and then I delete docx from cloud.
Is there an API which will allow me direct conversion of docx to pdf without the need to storing the file on cloud?
Hi,
Thanks for your inquiry. Please refer to the following article:
Hope this helps.
Best regards,
@svlungade
In addition to above post, please find sample code example for converting word document to PDF without storage with ConvertDocument API method.
const { WordsApi, ConvertDocumentRequest } = require("asposewordscloud");
var fs = require('fs');
wordsApi = new WordsApi("xxxx-xxxx-xxxxxx-xxxxx-xxxxxxxxxxxx", "xxxxxxxxxxxxxxxxxxxxxxxxx");
var request = new ConvertDocumentRequest({
format: "pdf",
document: fs.createReadStream("02_pages.docx"),
});
var outputFile = "C:/Temp/ConvertHTMLtoPDF.pdf";
wordsApi.convertDocument(request).then((result) => {
console.log(result.response.statusCode);
console.log(result.body.byteLength);
fs.writeFileSync(outputFile, result.body);
}).catch(function(err) {
// Deal with an error
console.log(err);
});