Export to HTML5
Info
In Aspose.Slides 21.9, we implemented support for HTML5 export.The export to HTML5 process here allows you to convert PowerPoint to HTML without web extensions or dependencies. This way, using your own templates, you can apply very flexible options that define the export process and the resulting HTML, CSS, JavaScript, and animation attributes.
Export PowerPoint to HTML5
This JavaScript code shows how you to export a presentation to HTML5 without web extensions and dependencies:
var pres = new aspose.slides.Presentation("pres.pptx");
try {
pres.save("pres.html", aspose.slides.SaveFormat.Html5);
} finally {
if (pres != null) {
pres.dispose();
}
}
You may want to specify settings for shape animations and slide transitions this way:
var pres = new aspose.slides.Presentation("pres.pptx");
try {
var html5Options = new aspose.slides.Html5Options();
html5Options.setAnimateShapes(false);
html5Options.setAnimateTransitions(false);
pres.save("pres5.html", aspose.slides.SaveFormat.Html5, html5Options);
} finally {
if (pres != null) {
pres.dispose();
}
}
Export PowerPoint to HTML
This JavaScript demonstrates the standard PowerPoint to HTML process:
var pres = new aspose.slides.Presentation("pres.pptx");
try {
pres.save("pres.html", aspose.slides.SaveFormat.Html);
} finally {
if (pres != null) {
pres.dispose();
}
}
In this case, the presentation content is rendered through SVG in a form like this:
<body>
<div class="slide" name="slide" id="slideslideIface1">
<svg version="1.1">
<g> THE SLIDE CONTENT GOES HERE </g>
</svg>
</div>
</body>
Note
When you use this method to export PowerPoint to HTML, due to the SVG rendering, you will not be to apply styles or animate specific elements.Export PowerPoint to HTML5 Slide View
Aspose.Slides allows you to convert a PowerPoint presentation to an HTML5 document in which the slides are presented in a slide view mode. In this case, when you open the resulting HTML5 file in a browser, you see the presentation in slide view mode on a web page.
This JavaScript code demonstrates the PowerPoint to HTML5 Slide View export process:
var pres = new aspose.slides.Presentation("pres.pptx");
try {
var html5Options = new aspose.slides.Html5Options();
html5Options.setAnimateShapes(true);
html5Options.setAnimateTransitions(true);
pres.save("HTML5-slide-view.html", aspose.slides.SaveFormat.Html5, html5Options);
} finally {
if (pres != null) {
pres.dispose();
}
}
Convert a Presentation to an HTML5 Document with Comments
Comments in PowerPoint are a tool that allows users to leave notes or feedback on presentation slides. They are especially useful in collaborative projects, where multiple people can add their suggestions or remarks to specific slide elements without altering the main content. Each comment shows the author’s name, making it easy to track who left the remark.
Let’s say we have the following PowerPoint presentation saved in the “sample.pptx” file.
When you convert a PowerPoint presentation to an HTML5 document, you can easily specify whether to include comments from the presentation in the output document. To do this, you need to specify the display parameters for comments in the notes_comments_layouting
property of the Html5Options class.
The following code example converts a presentation to an HTML5 document with comments displayed to the right of the slides.
let html5Options = new aspose.slides.Html5Options();
html5Options.getNotesCommentsLayouting().setCommentsPosition(aspose.slides.CommentsPositions.Right);
let presentation = new aspose.slides.Presentation("sample.pptx");
presentation.save("output.html", aspose.slides.SaveFormat.Html5, html5Options);
presentation.dispose();
The “output.html” document is shown in the image below.