Skip to content

Instantly share code, notes, and snippets.

@conholdate-gists
Last active April 26, 2024 10:59
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 conholdate-gists/a4e9290709ef71ce3e6b6b9d4a371482 to your computer and use it in GitHub Desktop.
Save conholdate-gists/a4e9290709ef71ce3e6b6b9d4a371482 to your computer and use it in GitHub Desktop.
Convert PDF to PPT using Java | Convert PDF to PPTX using Java
// Create an object of Document class and load the source file
Document doc = new Document("Sample.pdf");
// Invoke this method setBackground to set the background color of the document
doc.setBackground(java.awt.Color.CYAN);
// Call this setFitWindow method to set flag specifying whether document window must be resized to fit the first displayed page.
doc.setFitWindow(true);
// Instantiate PptxSaveOptions instance
com.aspose.pdf.PptxSaveOptions pptx_save = new com.aspose.pdf.PptxSaveOptions();
// If setSlidesAsImages method value is true then all the content is recognized as images (one per page)
pptx_save.setSlidesAsImages(true);
// Call setImageResolution method to set the resolution of the slides
pptx_save.setImageResolution(200);
// Save the output in PPT format by invoking the save method
doc.save(dataDir + "sample.ppt", pptx_save);
// Create an object of Document class and load the source file
Document doc = new Document("sample.pdf");
// Invoke this method setBackground to set the background color of the document
doc.setBackground(java.awt.Color.CYAN);
// Call this setFitWindow method to set flag specifying whether document window must be resized to fit the first displayed page.
doc.setFitWindow(true);
// Instantiate PptxSaveOptions instance
PptxSaveOptions pptx_save = new PptxSaveOptions();
// If setSlidesAsImages method value is true then all the content is recognized as images (one per page)
pptx_save.setSlidesAsImages(true);
// Call setImageResolution method to set the resolution of the slides
pptx_save.setImageResolution(200);
// Save the output in PPTX format by invoking the save method
doc.save("sample.pptx", pptx_save);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment