The conversion of PowerPoint presentations to image formats could be used in various scenarios. For example, to display the presentations in your web or desktop applications, to generate thumbnails, etc. Since PNG is one of the most popular image formats, in this article, you will learn how to convert PowerPoint PPT to PNG in Java. We will demonstrate how to convert each slide in a PPT presentation to a PNG image.
- Java PowerPoint PPT to PNG Converter - Free Download
- How to Convert PowerPoint PPT to PNG
- Convert PowerPoint PPTX to PNG in Java
PowerPoint PPT to PNG Java Converter
For PPTX or PPT to PNG conversion, we will use Aspose.Slides for Java. The API lets you create, manipulate and convert PowerPoint and OpenOffice presentations from within the Java applications. You can either download the API or install it using the following Maven configurations.
<repository> <id>AsposeJavaAPI</id> <name>Aspose Java API</name> <url>http://repository.aspose.com/repo/</url> </repository>
<dependency> <groupId>com.aspose</groupId> <artifactId>aspose-slides</artifactId> <version>23.5</version> <classifier>jdk16</classifier> </dependency>
Convert PPT to PNG in Java
Aspose.Slides for Java provides the simplest way of converting slides in PowerPoint PPT to PNG images. The following are the steps that you need to perform for PPT to PNG conversion in your Java applications.
- Load the PPT/PPTX presentation from disk.
- Set dimensions of output PNG image.
- Convert each slide in PPT to a PNG image.
- Save PNG image file on disk.
Let’s now transform these steps into the code to see how to convert a PPTX file to PNG in Java.
Java Code to Convert PPT to PNG
The following are the steps to convert slides in a PowerPoint PPT to PNG in Java.
- First, create an instance of the Presentation class to load the presentation.
- Define the dimensions of the resultant PNG image.
- Loop through each ISlide in Presentation.getSlides() collection.
- Generate image of the each slide using ISlide.getThumbnail(float ScaleX, float ScaleY) method and get the reference of image into a BufferedImage object.
- Create a new File for the output PNG image.
- Finally, save the PNG image using ImageIO.write(BufferedImage, String, File) method.
The following code sample shows how to convert a PPTX to PNG in Java.
Free PPT to PNG Java Converter
You can use Aspose.Slides for Java and convert your PowerPoint presentations to PNG without evaluation limitations by getting a free temporary license.
Online PowerPoint to PNG Converter
We also offer a free web-based PowerPoint to PNG converter that you can use to convert your PPT presentations to PNG images online. The converter is completely free and you do not even need to create an account.
In this article, you have learned how to convert slides in PowerPoint PPT to PNG images in Java. This could be useful when you need to embed PowerPoint presentations into your applications. You can simply install the API and use the provided code in your Java applications. In addition, you can visit the documentation to explore other features of API. Also, you can feel free to let us know about your queries via our forum.