Skip to content

Instantly share code, notes, and snippets.

@aspose-com-gists
Last active January 13, 2022 09:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aspose-com-gists/fe646f67623ee908e0403f3f1f6ae2ee to your computer and use it in GitHub Desktop.
Save aspose-com-gists/fe646f67623ee908e0403f3f1f6ae2ee to your computer and use it in GitHub Desktop.
Convert PUB to PPT PPTX PowerPoint Presentation Programmatically in Java
// Specify path for input Publisher file
String fileName = "Test.pub";
// Initialize ByteArrayOutputStream to hold intermediary PDF file.
final ByteArrayOutputStream os = new ByteArrayOutputStream();
// Initialize Pub Parser for the PUB file
IPubParser parser = PubFactory.createParser(fileName);
// Parse the Publisher file
com.aspose.pub.Document doc = parser.parse();
// Convert PUB to PDF file and save output into the stream
PubFactory.createPdfConverter().convertToPdf(doc, os);
// Load the intermediary PDF document
Document pdfDocument = new Document(os.toByteArray());
// Convert or Export the file to PPTX format
pdfDocument.save("Output.pptx", new PptxSaveOptions());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment