Skip to content

Instantly share code, notes, and snippets.

@aspose-cloud
Last active June 22, 2021 09:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aspose-cloud/0c9e5512027e6be34c267616d3864b85 to your computer and use it in GitHub Desktop.
Save aspose-cloud/0c9e5512027e6be34c267616d3864b85 to your computer and use it in GitHub Desktop.
This Gist contains code snippets related to conversion of PPTX to JPG and PNG formats
This Gist contains code snippets related to conversion of PPT and PPTX formats to JPG, PNG (raster image) formats.
// Get ClientID and ClientSecret from https://dashboard.aspose.cloud/
String clientId = "718e4235-8866-4ebe-bff4-f5a14a4b6466";
String clientSecret = "388e864b819d8b067a8b1cb625a2ea8e";
// create an instance of SlidesApi
SlidesApi slidesApi = new SlidesApi(clientId,clientSecret);
// load file from local system
File f = new File("/Users/nayyershahbaz/Documents/input.ppt");
// convert the file to Byte array
byte[] bytes = Files.readAllBytes(f.toPath());
// create instance of PutSlideSaveAsRequest
PutExportSlideRequest request = new PutExportSlideRequest();
// format of output file
request.setFormat(SlideExportFormat.PNG);
// name of input PPT available on Cloud Storage
request.setDocument(bytes);
// set slide index
request.setSlideIndex(1);
// name of resultant file
request.setOutPath("Converted.png");
// call the API method to perform PPT to PNG conversion
slidesApi.putExportSlide(request);
// Get ClientID and ClientSecret from https://dashboard.aspose.cloud/
String clientId = "718e4235-8866-4ebe-bff4-f5a14a4b6466";
String clientSecret = "388e864b819d8b067a8b1cb625a2ea8e";
// create an instance of SlidesApi
SlidesApi slidesApi = new SlidesApi(clientId,clientSecret);
// create instance of PutSlideSaveAsRequest
PutSlideSaveAsRequest request = new PutSlideSaveAsRequest();
// format of output file
request.setFormat(SlideExportFormat.JPEG);
// name of input PPTX available on Cloud Storage
request.setName("Presentation1.pptx");
// name of resultant file
request.setOutPath("Converted.jpeg");
// index of slide to be converted
request.setSlideIndex(1);
// call the API method to perform PPTX to JPG conversion
slidesApi.putSlideSaveAs(request);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment