Create Presentations in Java
Overview
This article shows how to create a presentation in Aspose.Slides, add a shape with text to its first slide, and save the result as a PPTX file. To open an existing presentation and save it in another format, see Open Presentations and Save Presentations. A short FAQ at the end covers common questions about formats, templates, slide sizing, units, memory usage, threading, licensing, digital signatures, and VBA support.
Before you begin, add Aspose.Slides for Java to your project from Aspose’s Maven repository. See Installation for the Maven setup and for what Linux needs in addition.
Create a Presentation
Creating a PowerPoint file from scratch in Aspose.Slides for Java starts with an instance of the Presentation class. The constructor supplies a blank presentation with a single slide, ready for shapes, text, charts, or any other content your application needs. Once you modify that slide, or add new ones, you can save the result to PPTX, legacy PPT, or OpenDocument formats.
To create a presentation and put a shape with text on its first slide, follow these steps:
- Create an instance of the Presentation class. A new presentation already contains one empty slide.
- Get that slide by its index, 0, from the collection that getSlides returns.
- Add an IAutoShape of the
Cloudtype with the addAutoShape method, and set its text with setText. - Save the presentation as a PPTX file with the save method.
The example below is a complete program. In the Maven project from Installation, save it as src/main/java/HelloSlides.java and run mvn compile exec:java.
import com.aspose.slides.*;
public class HelloSlides {
public static void main(String[] args) {
// Create a presentation. It already contains one empty slide.
Presentation presentation = new Presentation();
try {
// Get the first slide.
ISlide slide = presentation.getSlides().get_Item(0);
// Add a cloud shape and put text in it.
IAutoShape autoShape = slide.getShapes().addAutoShape(ShapeType.Cloud, 20, 20, 200, 80);
autoShape.getTextFrame().setText("Hello, Aspose!");
// Save the presentation as a PPTX file.
presentation.save("new_presentation.pptx", SaveFormat.Pptx);
} finally {
presentation.dispose();
}
}
}
The cloud’s top-left corner is 20 points from the left edge and 20 points from the top edge of the slide, and the shape is 200 points wide and 80 points high. The program saves new_presentation.pptx with one slide that holds the cloud and its text. Without a license, Aspose.Slides also adds an evaluation watermark to every slide it saves; see Licensing.
The result:

FAQ
What formats can I save a new presentation to?
You can save to PPTX, PPT, and ODP, and export to PDF, XPS, HTML, SVG, and images, among others.
Can I start from a template (POTX/POTM) and save as a regular PPTX?
Yes. Load the template and save to the desired format; POTX/POTM/PPTM and similar formats are supported.
How do I control slide size/aspect ratio when creating a presentation?
Set the slide size (including presets like 4:3 and 16:9 or custom dimensions) and choose how content should scale.
In what units are sizes and coordinates measured?
In points: 1 inch equals 72 units.
How do I handle very large presentations (with many media files) to reduce memory usage?
Use BLOB management strategies, limit in-memory storage by leveraging temporary files, and prefer file-based workflows over purely in-memory streams.
Can I create/save presentations in parallel?
You cannot operate on the same Presentation instance from multiple threads. Run separate, isolated instances per thread or process.
How do I remove the trial watermark and limitations?
Apply a license once per process. The license XML must remain unmodified, and the license setup should be synchronized if multiple threads are involved.
Can I digitally sign the PPTX I create?
Yes. Digital signatures (adding and verifying) are supported for presentations.
Are macros (VBA) supported in created presentations?
Yes. You can create/edit VBA projects and save macro-enabled files such as PPTM/PPSM.