Introduction
Aspose.Slides FOSS for Java is a free, open-source library that lets Java developers create and manipulate PowerPoint presentations without any dependency on Microsoft Office. The library ships under the org.aspose.slides.foss package and targets Java 21 and above.
The project is released under the MIT license, so you can use it in both personal and commercial projects at no cost and with no API key. It provides a rich object model for slides, shapes, text, tables, images, comments, and document properties, backed by direct manipulation of the Office Open XML package format.
With 273 classes, over 2,600 methods, and 42 enumerations, the core API covers the building blocks you need to automate presentation workflows in any Java application.
What’s Included
Presentation Lifecycle
The Presentation class is the entry point for every operation. You can create a blank presentation and save the result to disk or to an OutputStream in a variety of formats. The class implements AutoCloseable, so it works naturally with try-with-resources blocks.
import org.aspose.slides.foss.*;
import org.aspose.slides.foss.export.SaveFormat;
try (Presentation pres = new Presentation()) {
// A new presentation starts with one blank slide
System.out.println("Slides: " + pres.getSlides().size());
pres.save("output.pptx", SaveFormat.PPTX);
}
Slide Management
SlideCollection provides full control over the slide deck. You can add blank slides with addEmptySlide(), duplicate existing slides with addClone(), insert slides at a specific index with insertEmptySlide(), remove slides by reference or index, and iterate over the collection.
try (Presentation pres = new Presentation()) {
ILayoutSlide layout = pres.getLayoutSlides().get(0);
pres.getSlides().addEmptySlide(layout);
pres.getSlides().addClone(pres.getSlides().get(0));
System.out.println("Total slides: " + pres.getSlides().size());
}
Shapes and AutoShapes
The AutoShape class represents the most common drawable object on a slide. You create shapes through IShapeCollection.addAutoShape(), specifying a ShapeType constant (such as ShapeType.RECTANGLE) and position coordinates. Each AutoShape exposes a TextFrame for text content and a FillFormat for visual styling.
try (Presentation pres = new Presentation()) {
ISlide slide = pres.getSlides().get(0);
IAutoShape shape = slide.getShapes().addAutoShape(
ShapeType.RECTANGLE, 50, 50, 300, 100, false);
ITextFrame tf = shape.addTextFrame("Hello from Aspose.Slides FOSS");
System.out.println(tf.getText());
}
Text and Paragraphs
Rich text is modeled as a hierarchy of TextFrame, ParagraphCollection, Paragraph, PortionCollection, and Portion objects. You can set plain text on a frame directly with TextFrame.setText(), or build multi-run paragraphs by adding individual Portion instances with distinct formatting.
try (Presentation pres = new Presentation()) {
ISlide slide = pres.getSlides().get(0);
IAutoShape shape = slide.getShapes()
.addAutoShape(ShapeType.RECTANGLE, 50, 50, 400, 100, false);
ITextFrame tf = shape.addTextFrame("First run ");
Portion extra = new Portion("second run");
tf.getParagraphs().get(0).getPortions().add(extra);
System.out.println(tf.getText());
}
Document Properties
The DocumentProperties class exposes standard metadata fields such as title, author, subject, keywords, category, and timestamps. Properties are persisted in the PPTX core and extended properties parts and survive round-trip save/reload cycles.
try (Presentation pres = new Presentation()) {
IDocumentProperties props = pres.getDocumentProperties();
props.setTitle("Quarterly Report");
props.setAuthor("Engineering Team");
pres.save("report.pptx", SaveFormat.PPTX);
}
Comments and Annotations
The comment subsystem includes CommentAuthorCollection and CommentCollection. You can add authors, attach comments to specific slides and positions, and read back existing annotations. Comment data is stored in the ppt/commentAuthors.xml and ppt/comments/*.xml parts of the PPTX package.
Quick Start
Add the Maven dependency to your pom.xml:
<dependency>
<groupId>org.aspose.slides.foss</groupId>
<artifactId>aspose-slides-foss</artifactId>
<version>1.0.0</version>
</dependency>
Then create and save a presentation:
import org.aspose.slides.foss.*;
import org.aspose.slides.foss.export.SaveFormat;
public class QuickStart {
public static void main(String[] args) {
try (Presentation pres = new Presentation()) {
ISlide slide = pres.getSlides().get(0);
// Add a title shape
IAutoShape title = slide.getShapes().addAutoShape(
ShapeType.RECTANGLE, 50, 30, 600, 60, false);
title.addTextFrame("Aspose.Slides FOSS for Java");
// Add a content shape
IAutoShape body = slide.getShapes().addAutoShape(
ShapeType.RECTANGLE, 50, 120, 600, 300, false);
body.addTextFrame(
"This presentation was created entirely in Java "
+ "using a free, open-source library.");
pres.save("quick-start.pptx", SaveFormat.PPTX);
}
}
}
Supported Formats
The SaveFormat enumeration defines every output format the library can write. The table below lists the confirmed entries.
| Format | Extension | Write |
|---|---|---|
| PPTX | .pptx | Yes |
| PPTM | .pptm | Planned |
| PPSX | .ppsx | Planned |
| PPSM | .ppsm | Planned |
| POTX | .potx | Planned |
| POTM | .potm | Planned |
| ODP | .odp | Planned |
| OTP | .otp | Planned |
| FODP | .fodp | Planned |
| PPT | .ppt | Planned |
| PPS | .pps | Planned |
| POT | .pot | Planned |
| Planned | ||
| XPS | .xps | Planned |
| HTML | .html | Planned |
| HTML5 | .html | Planned |
| SVG | .svg | Planned |
| TIFF | .tiff | Planned |
| PNG | .png | Planned |
| JPEG | .jpeg | Planned |
| BMP | .bmp | Planned |
| GIF | .gif | Planned |
| MD | .md | Planned |
Note: Currently only PPTX export is implemented. Other format values exist in the SaveFormat enum for forward compatibility but are not yet functional. The save() method always produces PPTX output regardless of the format parameter.
Open Source & Licensing
Aspose.Slides FOSS for Java is distributed under the MIT license. The full source code is available on GitHub at Aspose.Slides-FOSS-for-Java. You are free to use, modify, and redistribute the library in any project without royalties or license keys.
Getting Started
Ready to dive deeper? Here are resources to help you get started:
- Developer Guide – walkthroughs and tutorials for every feature area
- Knowledge Base – how-to articles and frequently asked questions
- API Reference – full class and method documentation