You can convert a presentation to an image file. The following program shows how to go about it.

    1. import java.awt.Color;
    2. import java.awt.Dimension;
    3. import java.awt.Graphics2D;
    4. import java.awt.geom.Rectangle2D;
    5. import java.awt.image.BufferedImage;
    6. import java.io.File;
    7. import java.io.FileInputStream;
    8. import java.io.FileOutputStream;
    9. import java.io.IOException;
    10.  
    11. import org.apache.poi.xslf.usermodel.XMLSlideShow;
    12. import org.apache.poi.xslf.usermodel.XSLFSlide;
    13.  
    14. public class PptToImage {
    15.  
    16. public static void main(String args[]) throws IOException {
    17.  
    18. //creating an empty presentation
    19. File file=new File(“pptToImage.pptx”);
    20. XMLSlideShow ppt = new XMLSlideShow(new FileInputStream(file));
    21.  
    22. //getting the dimensions and size of the slide
    23. Dimension pgsize = ppt.getPageSize();
    24. XSLFSlide[] slide = ppt.getSlides();
    25.  
    26. BufferedImage img = null;
    27.  
    28. for (int i = 0; i < slide.length; i++) {
    29. img = new BufferedImage(pgsize.width, pgsize.height,BufferedImage.TYPE_INT_RGB);
    30. Graphics2D graphics = img.createGraphics();
    31.  
    32. //clear the drawing area
    33. graphics.setPaint(Color.white);
    34. graphics.fill(new Rectangle2D.Float(0, 0, pgsize.width, pgsize.height));
    35.  
    36. //render
    37. slide[i].draw(graphics);
    38.  
    39. }
    40.  
    41. //creating an image file as output
    42. FileOutputStream out = new FileOutputStream(“ppt_image.png”);
    43. javax.imageio.ImageIO.write(img, png”, out);
    44. ppt.write(out);
    45.  
    46. System.out.println(“Image successfully created”);
    47. out.close();
      }
    48. }

    Save the above Java code as PpttoPNG.java, and then compile and execute it from the command prompt as follows −

    1. $javac PpttoPNG.java
    2. $java PpttoPNG

    It will compile and execute to generate the following output −

    1. Image created successfully

    The following snapshot shows the presentation that is given as input −

    presentation1 (1).jpg

    Given below is the snapshot of the image created at the specified location.

    ppt_image.jpg