Today I will show you how to convert Powerpoint to XPS in Java. This time, you need a library called Spire.Presentation for Java. It is free and can be used without downloading Microsoft Office software.
Let's go
1. From the official website of E-iceblue Free Spire. Presentation for Download the free version of Java .
2. Launch the IDE to create a new project, then add the appropriate Spire. Presentation.jar to the reference that was in the installed file.
```java import com.spire.presentation.*;
public class PPTtoXPS { public static void main(String[] args) throws Exception{
//Create a presentation object.
Presentation ppt = new Presentation();
//Load the file.
ppt.loadFromFile("Sample.pptx");
//Save with XPS.
ppt.saveToFile("toXPS.xps", FileFormat.XPS);
ppt.dispose();
}
}
<h4> Completion example </h4>
<p><img src="https://cdn-ak.f.st-hatena.com/images/fotolife/l/lendoris/20201223/20201223152106.png " alt="f:id:lendoris:20201223152106p:plain" title="" class="hatena-fotolife" itemprop="image" /></p>
<p><strong> </strong></p>
<p><strong> </strong></p>
<p><strong> </strong></p>
<p><strong> </strong></p>
<p><strong> </strong></p>
<p><strong> </strong></p>
<p><strong> </strong></p>
<p><strong> </strong></p>
<p><strong> </strong></p>
Recommended Posts