使用 Aspose.Total for Java ,您可以在任何 Java J2SE、J2EE、J2ME 应用程序中轻松地将 EPUB 转换为 PPTM。首先,通过使用 Aspose.PDF for Java ,您可以将 EPUB 导出为 PPTX。之后,通过使用 Aspose.Slides for Java PowerPoint Processing API,您可以将 PPTX 转换为 PPTM。
Java API 将 EPUB 转换为 PPTM
- 用 Document 类打开EPUB文件
- 使用 save 方法将 EPUB 转换为 PPTX
- 用 Presentation 类加载PPTX文档
- 使用
save
方法将文档保存为 PPTM 格式并设置
Pptm
作为 SaveFormat
Document document = new Document("template.epub"); | |
document.save("PptxOutput.pptx", SaveFormat.Pptx); | |
Presentation presentation = new Presentation("PptxOutput.pptx"); | |
presentation.save("output.ppt", SaveFormat.Ppt); |
通过 Java 打开加密的 EPUB 文件
加载 EPUB 文件格式时,您的文档可能受密码保护。 Aspose.PDF for Java 也允许您打开加密文档。为了打开加密文件,您可以初始化[Document]的新实例( https://reference.aspose.com/pdf/java/com.aspose.pdf/Document#Document-java.lang.String-java.lang.String- ) 类并将文件名和密码作为参数传递。
// open EPUB document
Document doc = new Document("input.epub", "Your@Password");
// save EPUB as PPTX format
document.save("PptxOutput.pptx", SaveFormat.Pptx);
通过 Java 保存具有预定义视图类型的 PPTM 文件
将 EPUB 转换为 PPTM 后,您还可以为演示文稿添加预定义的视图类型。 Aspose.Slides for Java 提供了一种工具来设置生成的演示文稿在通过 [ViewProperties](https:// /apireference.aspose.com/slides/java/com.aspose.slides/ViewProperties) 类。 setLastView 属性用于通过使用[ViewType](https:// /apireference.aspose.com/slides/java/com.aspose.slides/ViewType) 枚举器。
// 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 Pptm format
presentation.save("output.pptm", SaveFormat.Pptm);