We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Some page of PPTX could not be converted to image (Nodejs)

Hi ,

I was trying to use nodejs SDK to convert PPXT to png by using the code given in example. Some page could be converted, while some couldn’t:

Here’s the code :

var filename = “test”;
var name = filename + “.pptx”;
var slideIndex = 15;
var format = “png”;

var versionId = null;
var storage = null;
var folder = null;

try {
// Upload source file to aspose cloud storage
storageApi.PutCreate(name, versionId, storage, data_path + name , function(responseMessage) {

assert.equal(responseMessage.status, 'OK');

// Invoke Aspose.Slides Cloud SDK API to save a particular slide as image
slidesApi.GetSlideWithFormat(name, slideIndex, format, null, null, folder, storage, function(responseMessage) {
		assert.equal(responseMessage.status, 'OK');
		// Save converted format file from response
		var outfilename = filename + "." + format;

		let filePath = path.resolve(__dirname, outfilename);

		var writeStream = fs.createWriteStream(filePath);
		// var writeStream = fs.createWriteStream(data_path + outfilename);

}catch (e) {
console.log(“exception in example”);

I check my Aspose dashboard, for the pages that could not be converted, it says "Error: Authentication failed!. ".

This is the ppt: http://docs-1252949942.costj.myqcloud.com/test.pptx

Many thanks


Thank you for contacting Aspose.Support.

From the code snippet you have shared, it appears you have not authenticated the API.

A common method for authenticating your API in NodeJS is below

var AppSID = configProps.app_sid;
var AppKey = configProps.api_key;
var outFolder = configProps.out_folder;
var config = {'appSid':AppSID,'apiKey':AppKey , 'debug' : true};

// Instantiate Aspose Storage API SDK
var storageApi = new StorageApi(config);
// Instantiate Aspose.Slides API SDK
var slidesApi = new SlidesApi(config);

Please do so and let me know if the issue remains.

Thank You.