Parse PPTX Files in Java

Extract text and presentation content from PPTX documents using server-side Aspose.Slides for Java APIs.

Parse PPTX File Using Java

Use Aspose.Slides for Java to parse PPTX presentations and extract text from slides. You can add the library to a Maven-based project by using the repository and dependency configuration below in your pom.xml file.

Repository

<repository>
    <id>AsposeJavaAPI</id>
    <name>Aspose Java API</name>
    <url>https://releases.aspose.com/java/repo/</url>
</repository>

Dependency

<dependency>
    <groupId>com.aspose</groupId>
    <artifactId>aspose-slides</artifactId>
    <version>26.8</version>
    <classifier>jdk16</classifier>
</dependency>

Parse PPTX Files - Java

Presentation presentation = new Presentation("demo.pptx");
try {
    ISlide slide = presentation.getSlides().get_Item(0);
    ITextFrame[] slideTextFrames = SlideUtil.getAllTextBoxes(slide);

    for (ITextFrame textFrame : slideTextFrames) {
        for (IParagraph paragraph : textFrame.getParagraphs()) {
            for (IPortion portion : paragraph.getPortions()) {
                System.out.print(portion.getText());
                System.out.print(portion.getPortionFormat().getFontHeight());
                System.out.print(portion.getPortionFormat().getLatinFont().getFontName());
            }
        }
    }
} finally {
    presentation.dispose();
}

How to Parse PPTX Files in Java

Extract text from a PPTX presentation with Aspose.Slides for Java in a few lines of code.

  1. Load the PPTX file with the Presentation class.
  2. Call the SlideUtil.getAllTextBoxes method to get text frames from the first slide.
  3. Loop through each ITextFrame, IParagraph, and IPortion object.
  4. Read text, font height, and font name from each IPortion object.

System Requirements

Aspose.Slides for Java supports major platforms and operating systems. Make sure that your environment includes the following prerequisites.

  • Microsoft Windows or a compatible operating system with a Java Runtime Environment for JSP/JSF applications and desktop applications.
  • The latest version of Aspose.Slides for Java from Maven .

Built with Aspose.Slides

Extract Text and Images Online

The free Aspose.Slides Parser app is built with Aspose.Slides for Java, the same API as the code above. Open it and see what the API can do with your own PPTX files.

  • Runs in your browser, nothing to install.
  • See how Aspose.Slides reads your files before you write code.
  • Upload your PPTX file and get its text and images.
  • Download everything as one ZIP archive.

What is PPTX File Format?

Files with the PPTX extension use the Office Open XML presentation format. A PPTX file stores slides that can contain text, images, formatting, animations, and other presentation content.

Read More

Other Supported Parsing Formats

Using Java, you can also parse other presentation formats.