To convert PowerPoint slides to images, multiple packages are required like, java.awt because It contains all the classes for creating user interfaces and for painting graphics and images, java.io because It provides a set of input streams and a set of output streams used to read and write data to files or other input and output sources, Apache POI because It is used to create, modify, and display Microsoft Office files using Java programs.
Download Apache POI
- Dowload the zip file from the official site.
- Extract the external jar files from the zip file.
- Add the external jar files.
For that select Java Build Path -> Configure Build Path -> Libraries -> Class -> Add External Jars…
- Select the jar file from the required folder
- Click Apply and close.
Imports from java.awt
- java.awt.Color: This class has the colors needed to change the appearance of objects in the interface.
- java.awt.Dimension It contains the height and width of a component.
- java.awt.Graphics2D It provides provides control over geometry, coordinate transformations, color management, and text layout.
- java.awt.geom.Rectangle2D It describes a rectangle defined by a location (x,y) and dimension (w x h) .
- java.awt.image.BufferedImage It is used to handle and manipulate the image data.
Imports from java.io
- java.io.File: It contains several methods for working with the path name, deleting and renaming files,etc.
- java.io.FileInputStream: It is used to read data from a file.
- java.io.FileOutputStream: It is used for writing data to a File.
- java.io.IOException: It is an exception which is used in the code to throw a failure in Input and Output operations
Imports from Apache POI
- org.apache.poi.xslf.usermodel.XMLSlideShow: It is used to create objects to read or write a slideshow.
- org.apache.poi.xslf.usermodel.XSLFSlide: It is used create and manage a slide in a presentation.
Before the execution of the program:
After Execution of the program:
Attention reader! Don’t stop learning now. Get hold of all the important Java Foundation and Collections concepts with the Fundamentals of Java and Java Collections Course at a student-friendly price and become industry ready. To complete your preparation from learning a language to DS Algo and many more, please refer Complete Interview Preparation Course.