Skip to content

Instantly share code, notes, and snippets.

@blog-aspose-cloud
Last active October 13, 2022 06:27
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 blog-aspose-cloud/47a8d4f632895589633e395c860ecac3 to your computer and use it in GitHub Desktop.
Save blog-aspose-cloud/47a8d4f632895589633e395c860ecac3 to your computer and use it in GitHub Desktop.
Convert PowerPoint to HTML

Convert PowerPoint to HTML


This Gist shares details on how to convert PowerPoint to HTML using Aspose.Slides Cloud SDK for Java.

In following code snippet, we are first uploading the input PowerPoint to cloud storage and then callSavePresentation(…) method to generate HTML file. The resultant HTML is then stored in Cloud storage. For complete details, please visit Convert PowerPoint to HTML in Java.

PowerPoint to HTML

Important Links

Home | Product Page | Docs | API Reference | Cloud Dashboard | Code Samples | Source Code | Blog | Free Support | Free Trial

Convert PowerPoint to HTML using Aspose.Slides Cloud SDK for Java
// for more examples, please visit https://github.com/aspose-slides-cloud/aspose-slides-cloud-java/tree/master/Examples/src/main/java/com/aspose/cloud/examples
try
{
// Get ClientID and ClientSecret from https://dashboard.aspose.cloud/
String clientId = "bbf94a2c-6d7e-4020-b4d2-b9809741374e";
String clientSecret = "1c9379bb7d701c26cc87e741a29987bb";
// create an instance of SlidesApi
SlidesApi slidesApi = new SlidesApi(clientId,clientSecret);
// load file from local system
File f = new File("c://Users/test-unprotected.pptx");
// convert the file to Byte array
byte[] bytes = Files.readAllBytes(f.toPath());
// upload file to cloud storage
slidesApi.uploadFile("input.ppt", bytes, "Internal");
// create htmlExport Options instance
// Use the Helvetica font if any presentation font is not found.
HtmlExportOptions htmlOptions = new HtmlExportOptions();
htmlOptions.setDefaultRegularFont("Helvetica");
// The HTML document should only contain the slides with indexes 1 and 3
List slideIndices = Arrays.asList(1, 3);
// call method to insert webpage into PowerPoint
slidesApi.savePresentation("input.ppt", ExportFormat.HTML, "Converted.html",htmlOptions, "","","Internal", "",slideIndices);
// print success message
System.out.println("PowerPoint sucessfully converted to HTML format !");
}catch(Exception ex)
{
System.out.println(ex.getStackTrace());
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment