This brief tutorial provides details about how to convert PPTX to XPS file using Java. You can convert PPTX to XPS format that contains the structure, contents, appearance, and layout of the document. The following steps can be used to export PPTX to XPS in Java in your applications.
Steps to Convert PPTX to XPS File using Java
- Install Aspose.Slides from the Maven repository to convert PPTX to XPS
- Load the input PPTX file using the Presentation class object
- Save the PPTX as XPS file
These steps first set up the library and then instantiate the Presentation class object to load the input PPTX file. Then it exports the PPTX to XPS file format.
Code to Convert PPTX to XPS File using Java
import com.aspose.slides.License; | |
import com.aspose.slides.Presentation; | |
import com.aspose.slides.SaveFormat; | |
public class HowToConvertPptxToXPSUsingJava { | |
public static void main(String[] args) throws Exception { //main function for converting PPTX to XPS | |
// Load a license to avoid trial version watermark in the output XPS file | |
License license = new License(); | |
license.setLicense("Aspose.Slides.lic"); | |
// Load the presentation to convert to XPS in Java | |
Presentation PptxToXPS = new Presentation("ExportPptxToXPS.pptx"); | |
// Save output XPS file | |
PptxToXPS.save("PresentationConvertedToXPS.xps", SaveFormat.Xps); | |
} | |
} |
This code snippet in Java loads the input PPTX file without needing you to install any other application like MS PowerPoint or Interop. In this tutorial, we have learned how to create XPS from PPTX using Java. If you want to convert the presentation slides to SVG images then please take a look at the article on how to convert PPTX to SVG using Java.