Free Support Forum - aspose.cloud

Convert a Word / PDF Document to other formats in Node.js using Aspose.Words REST API

Hi,
I don’t see the proper parameters to pass to the wordsApi.convertDocument() method in node npm documentation for the GET : [​/words​/{name}] API(Converts a document in cloud storage to the specified format.)
Please suggest me.
Thanks.

@vinodhkumar

Please find sample code for GetDocumentWithFormat using Aspose.Words Cloud SDK for Node.js. You can also check unit test for details.

const remoteFileName = "02_pages.pdf";
const remoteFolder = "Temp/Temp";
const outputFile = "C:/Temp/02_pages.docx";


//convert document
const request = new GetDocumentWithFormatRequest();
                request.name = remoteFileName;
                request.folder = remoteFolder;
                request.format = "docx";
				
wordsApi.getDocumentWithFormat(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);
});