Wiki

Clone wiki

Aspose Java for Docx4j / Convert-Presentation-to-HTML

Aspose.Slides

//Instantiate Presentation class that represents PPTX file
Presentation pres = new Presentation(dataPath + "presentation.pptx");

HtmlOptions htmlOpt = new HtmlOptions();
htmlOpt.setHtmlFormatter(HtmlFormatter.createDocumentFormatter("",false));

//Saving the presentation to HTML
pres.save(dataPath + "AsposeHTML.html", SaveFormat.Html, htmlOpt);

Download Download Example Code

PPTX4j

String inputfilepath = dataPath + "pptx-basic.xml";

// Where to save images
SvgExporter.setImageDirPath(dataPath);

PresentationMLPackage presentationMLPackage = 
    (PresentationMLPackage)PresentationMLPackage.load(new java.io.File(inputfilepath));     

// TODO - render slides in document order!
Iterator partIterator = presentationMLPackage.getParts().getParts().entrySet().iterator();
while (partIterator.hasNext()) {

    Map.Entry pairs = (Map.Entry)partIterator.next();

    Part p = (Part)pairs.getValue();
    if (p instanceof SlidePart) {

        System.out.println(
                SvgExporter.svg(presentationMLPackage, (SlidePart)p)
                );
    }
}

// NB: file suffix must end with .xhtml in order to see the SVG in a browser

Download Download Example Code

Updated