Set resolution for images when rendering to HTML

Some presentations might have high-resolution (pictures, backgrounds, etc.) images, for some cases you need to reduce the resolution to get a smaller rendered HTML file size.

Available resolution options

In GroupDocs.Viewer.Options.BaseViewOptions class there GroupDocs.Viewer.Options.PresentationOptions property with GroupDocs.Viewer.Options.Resolution property which contains resolution options, you can refer to this table to make the right choice for your final document purpose:

Resolution optionResolution in DPIOptimal use
Resolution.DocumentResolutionAs in the documentDefault value - as in the document.
Resolution.Dpi7272Max compression, low quality.
Resolution.Dpi9696Good for web pages and projectors.
Resolution.Dpi150150Good for web pages and projectors.
Resolution.Dpi220220Excellent quality on most printers and screens.
Resolution.Dpi330330Good quality for high-definition (HD) displays.

To set resolution when converting presentation files to HTML with GroupDocs.Viewer for .NET use following code:

using (Viewer viewer = new Viewer("sample.pptx"))
{
      HtmlViewOptions options = HtmlViewOptions.ForEmbeddedResources("result_{0}.html");
      htmlViewOptions.PresentationOptions.Resolution = Resolution.Dpi150;

      viewer.View(options);
}

Comparison size with different resolutions

We’ve taken a sample presentation where each slide is an image and compared output size with different resolution options.

The resolution, DPIOutput size
Document resolution165 MB
727.4 MB
9611.76 MB
15021.49 MB
22036.21 MB
33067 MB

© Aspose Pty Ltd 2001-2022. All Rights Reserved.