Aspose.Total for Java is a comprehensive suite of components that enables developers to easily convert PDF to OTP within any Java J2SE, J2EE, J2ME application. The process involves two steps, firstly converting PDF to PPTX and then PPTX to OTP.
The first step is to use Aspose.PDF for Java, a powerful PDF Processing API that enables developers to export PDF to PPTX. It provides a wide range of features such as creating, editing, converting, and manipulating PDF documents without any additional software. It also supports a variety of formats such as PDF, XPS, TIFF, HTML, and many more.
The second step is to use Aspose.Slides for Java, a PowerPoint Processing API that enables developers to convert PPTX to OTP. It provides a wide range of features such as creating, editing, converting, and manipulating PowerPoint presentations without any additional software. It also supports a variety of formats such as PPTX, PPT, ODP, OTP, and many more.
Aspose.Total for Java is a comprehensive suite of components that makes it easy to convert PDF to OTP within any Java J2SE, J2EE, J2ME application. It provides a wide range of features such as creating, editing, converting, and manipulating PDF and PowerPoint documents without any additional software. It also supports a variety of formats such as PDF, XPS, TIFF, HTML, PPTX, PPT, ODP, OTP, and many more.
Java API to Convert PDF to OTP
- Open PDF file using Document class
- Convert PDF to PPTX by using save method
- Load PPTX document by using Presentation class
- Save the document to OTP format using
save
method and set
Otp
as SaveFormat
Get Started with Java File Format APIs
You can easily use Aspose.Total for Java directly from a Maven based project and include Aspose.PDF for Java and Aspose.Slides for Java in your pom.xml.
Alternatively, you can get a ZIP file from downloads .
// load PDF file with an instance of Document class
Document document = new Document("template.pdf");
// save PDF as PPTX format
document.save("PptxOutput.pptx", SaveFormat.Pptx);
// instantiate a Presentation object that represents a PPTX file
Presentation presentation = new Presentation("PptxOutput.pptx");
// save the presentation as Otp format
presentation.save("output.otp", SaveFormat.Otp);
Open Encrypted PDF File via Java
While loading PDF file format, your document might be password protected. Aspose.PDF for Java allows you open encrypted documents as well. In order to open the encrypted file, you can initialize new instance of the Document class and pass filename and password as arguments.
// open PDF document
Document doc = new Document("input.pdf", "Your@Password");
// save PDF as PPTX format
document.save("PptxOutput.pptx", SaveFormat.Pptx);
Save OTP File with Predefined View Type via Java
After converting PDF to OTP, you can also add predefined view type for your presentation. Aspose.Slides for Java provides a facility to set the view type for the generated presentation when it is opened in PowerPoint through the ViewProperties class. The setLastView property is used to set the view type by using the ViewType enumerator.
// instantiate a Presentation object that represents a PPTX file
Presentation presentation = new Presentation("PptxOutput.pptx");
// set view type
presentation.getViewProperties().setLastView((byte) ViewType.SlideMasterView);
// save the presentation as Otp format
presentation.save("output.otp", SaveFormat.Otp);