Java: Convert ODP to PDF

The OpenDocument Presentation Document Format, commonly referred to as ODP, is one of the file extensions of an Open Document Format file and is designed to serve as an open-source display format for slideshow presentations. Sometimes you may need to convert an ODP file to PDF to ensure the document's formatting remains intact. In this article, you will learn how to achieve this function using Spire.Presentation for Java.

Install Spire.Presentation for Java

First of all, you're required to add the Spire.Presentation.jar file as a dependency in your Java program. The JAR file can be downloaded from this link. If you use Maven, you can easily import the JAR file in your application by adding the following code to your project's pom.xml file.

<repositories>
    <repository>
        <id>com.e-iceblue</id>
        <name>e-iceblue</name>
        <url>https://repo.e-iceblue.com/nexus/content/groups/public/</url>
    </repository>
</repositories>
<dependencies>
    <dependency>
        <groupId>e-iceblue</groupId>
        <artifactId>spire.presentation</artifactId>
        <version>9.4.5</version>
    </dependency>
</dependencies>
    

Convert ODP to PDF

You can convert ODP to PDF using Spire.Presentation for Java in an easy and quick manner by following the steps listed below.

  • Create a Presentation object.
  • Load a sample ODP document using Presentation.loadFromFile() method.
  • Save the document as PDF using Presentation.saveToFile() method.
  • Java
import com.spire.presentation.*;

public class ODPtoPDF {
    public static void main(String[] args) throws Exception {

        //Create a Presentation instance
        Presentation presentation = new Presentation();

        //Load a sample ODP file
        presentation.loadFromFile("toPDF.odp",FileFormat.ODP);
        
        //Save it as PDF
        presentation.saveToFile("output/Result.pdf", FileFormat.PDF);
    }
}

The original file:

Java: Convert ODP to PDF

The generated file:

Java: Convert ODP to PDF

Apply for a Temporary License

If you'd like to remove the evaluation message from the generated documents, or to get rid of the function limitations, please request a 30-day trial license for yourself.