Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save conholdate-gists/0095480f879ec3f53e501ff29b7a8f3e to your computer and use it in GitHub Desktop.

Select an option

Save conholdate-gists/0095480f879ec3f53e501ff29b7a8f3e to your computer and use it in GitHub Desktop.
Convert PPTX to JPEG with Conholdate.Total for Java
import com.aspose.slides.ImageSaveOptions;
import com.aspose.slides.Presentation;
import com.aspose.slides.SaveFormat;
public class PptxToJpeg {
public static void main(String[] args) {
// Path to the source PPTX file
String sourcePath = "input.pptx";
// Output folder for JPEG images
String outputFolder = "output/";
try {
// Load the PPTX presentation
Presentation presentation = new Presentation(sourcePath);
// Configure JPEG save options
ImageSaveOptions jpegOptions = new ImageSaveOptions(SaveFormat.Jpeg);
jpegOptions.setQuality(90); // Set JPEG quality (0-100)
// Iterate through all slides and save each as a JPEG file
for (int i = 0; i < presentation.getSlides().size(); i++) {
String outputPath = outputFolder + "slide_" + (i + 1) + ".jpeg";
presentation.getSlides().get_Item(i).save(outputPath, jpegOptions);
System.out.println("Saved: " + outputPath);
}
System.out.println("Conversion completed successfully.");
} catch (Exception e) {
System.err.println("Error during conversion: " + e.getMessage());
e.printStackTrace();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment