This gist explains the steps and code snippet on how to convert XLS to PDF format using Aspose.Cells Cloud SDK for Node.js.
For more information, please visit
This gist explains the steps and code snippet on how to convert XLS to PDF format using Aspose.Cells Cloud SDK for Node.js.
For more information, please visit
This Gist contains code snippets related to conversion of XLS to PDF using Aspose.Cells Cloud SDK for Node.js |
const { CellsApi, CellsSaveAs_PostDocumentSaveAsRequest,UploadFileRequest,PdfSaveOptions } = require("asposecellscloud"); | |
// Get your ClientId and ClientSecret from https://dashboard.aspose.cloud (free registration required). | |
const clientId = "718e4235-8866-4ebe-bff4-f5a14a4b6466"; | |
const clientSecret = "388e864b819d8b067a8b1cb625a2ea8e"; | |
// create an instnace of CellsApi | |
const cellsApi = new CellsApi(clientId, clientSecret); | |
// name of input Excel document | |
filename = "conditional.xlsx" | |
// include File System module reference in your code | |
const fs = require("fs"); | |
// read the content of input Excel file | |
var data =fs.createReadStream("/Users/nayyershahbaz/Downloads/"+ filename); | |
// create FileUpload Request instance | |
var req = new UploadFileRequest(); | |
req.path = filename; | |
// set the content as Stream instance containing loaded Excel file | |
req.file = data; | |
// Upload the file to cloud storage | |
return cellsApi.uploadFile(req) | |
.then((result) => { | |
// Create Document SaveAsRequest instance | |
var req = new CellsSaveAs_PostDocumentSaveAsRequest(); | |
req.name = filename; | |
// Create an object of PdfSaveOptions class | |
req.saveOptions = new PdfSaveOptions(); | |
// set the resultant file format as PDF | |
req.saveOptions.saveFormat = "pdf"; | |
// set the name for new resultant file | |
req.newfilename = "newbook.pdf"; | |
// since we are going to save in default location, so we will set null as folder value | |
req.folder = null; | |
// Call the SaveAsPostDocument method to initiate the conversion process | |
return cellsApi.cellsSaveAsPostDocumentSaveAs(req) | |
.then((result) => { | |
expect(result.body.code).to.equal(200); | |
expect(result.response.statusCode).to.equal(200); | |
}); | |
}); |