Convert PowerPoint to PDF in Java

The article demonstrates how to convert PowerPoint (.pptx and .ppt) documents to PDF documents using Spire.Presentation for Java.

Here is the screenshot of the sample PowerPoint file.

Convert PowerPoint to PDF in Java

Entire Code

import com.spire.presentation.FileFormat;
import com.spire.presentation.Presentation;

public class PPTXtoPDF {

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

        //create a Presentataion instance
        Presentation presentation = new Presentation();

        //load the sample PowerPoint file
        presentation.loadFromFile("C:/Users/Administrator/Desktop/example.pptx");

        //save to PDF file
        presentation.saveToFile("toPDF.pdf", FileFormat.PDF);
        presentation.dispose();
    }
}

Output

Convert PowerPoint to PDF in Java