Convert-project-document-to-the-specified-format

Given Node.js code is not working properly
can you please help me out through this

@iamhamza

We are sorry for the inconvenience. After initial investigation we have logged a ticket TASKSCLOUD-471 to fix the Node.js SDK example and will update you asap.

1 Like

@iamhamza

Please find a working Node.js code for Project to PDF conversion. You can convert the Project file to supported file formats using Aspose.Tasks Cloud API.


const { TasksApi } = require("@asposecloud/aspose-tasks-cloud");
const { GetTaskDocumentWithFormatRequest, ProjectFileFormat } = require("@asposecloud/aspose-tasks-cloud/dist/src/model/model");
var fs = require('fs');

// Please get your ClientId and Secret https://dashboard.aspose.cloud.
tasksApi = new TasksApi("xxxx-xxxx-xxxx-xxxx-xxxxxxxxx", "xxxxxxxxxxxxxxxxxxxxxxx");

const fileName = "sample.mpp";
const remotePath = "Temp/tasks";


"ProjectFileFormat.Csv", folder: remotePath});
const request = new GetTaskDocumentWithFormatRequest();
request.name = fileName;
request.folder = remotePath;
request.format = ProjectFileFormat.pdf;

tasksApi.getTaskDocumentWithFormat(request).then((result) => {    
    console.log(result.response.status);   
	fs.writeFileSync('C:/Temp/sample.pdf', result.body);
    console.log('Completed...');	
}).catch(function(err) {
    // Deal with an error
    console.log(err);
});