Free Support Forum -

DOCX to PDF Conversion with Aspose.Words Cloud SDK for Node.js PostDocumentSaveAsRequest error


I am using the aspose.words sdk for node.js. I am getting a ‘TypeError: PostDocumentSaveAsRequest is not a constructor’ from the following:

var request = new PostDocumentSaveAsRequest({
name: response.fileName,
saveOptionsData: new SaveOptionsData(
saveFormat: “pdf”,
fileName: response.fileName.replace(’.docx’, ‘.pdf’)

Thank you


Thanks for your inquiry. Please note we have recently released an improved API version 4. We have released updated Node.js SDK for V4 version on NPM as well. There are a lot of breaking changes. PostDocumentSaveAsReqest changed to SaveAsRequest. Please find sample code for reference. However, if you face any issue please feel free to contact us for any assistance. Please note V1.1 will remain working with previous SDKs.

const request = new SaveAsRequest({
                        saveOptionsData: new SaveOptionsData({
                            saveFormat: "pdf",
                            fileName: "Test.pdf",

           = "Test.docx";
                    request.folder = "Temp";

wordsApi.saveAs(request).then((result) => {    
}).catch(function(err) {
    // Deal with an error