Table of Contents

Introduction

The PresentationToJpegConverter class in the Slidize.Plugins library allows you to convert PowerPoint and OpenDocument presentations into a set of JPEG images, with each slide rendered as a high-quality image. This is useful when you need to generate thumbnails, use slides as standalone images, or embed them into documents, web pages, or other media.

Here we will explore how to use the PresentationToJpegConverter class, covering its basic functionality as well as advanced configuration options, with detailed examples written in C#.

Basic PowerPoint to JPEG Conversion

To get started, here is the simplest example of converting a PowerPoint presentation to a set of JPEG images. Each slide will be converted to a separate image.

using Slidize;

PresentationToJpegConverter.Process("presentation.pptx", "image.jpg");

In this example, the Process method is called with the path to the PowerPoint file and the file name pattern for the output images should be saved. Each slide in the presentation will be saved as a separate JPEG image.

Customize Image Size

You can control the size of the generated JPEG images by specifying custom dimensions using the ImageWidth and ImageHeight properties in the ImageConverterOptions class. This is useful when you need images to fit a specific size requirement.

using Slidize;

var options = new ImageConverterOptions
{
    ImageWidth = 1024,
    ImageHeight = 768
};

PresentationToJpegConverter.Process("presentation.pptx", "image.jpg", options);

In this example, each slide is exported as a 1024x768 image, regardless of the original slide dimensions.

Scale Images

You can use the ImageScale property in the ImageConverterOptions class to scale the images up or down based on the original slide dimensions. The scale factor controls how much to enlarge or shrink the image.

using Slidize;

var options = new ImageConverterOptions
{
    ImageScale = 1.5f
};

PresentationToJpegConverter.Process("presentation.pptx", "image.jpg", options);

In this example, the ImageScale is set to 1.5f, which increases the size of the output images by 1.5 times compared to the original slide dimensions.

Set a Default Regular Font

The DefaultRegularFont property in the ImageConverterOptions class allows you to specify a default font to use when converting PowerPoint and OpenDocument slides into images, particularly in cases where the original fonts used in the presentation are missing or not supported on the target machine. This feature is helpful for ensuring that the text in your slides renders properly, even if the exact font is unavailable.

using Slidize;

var options = new ImageConverterOptions
{
    DefaultRegularFont = "Arial"
};

PresentationToJpegConverter.Process("presentation.pptx", "image.jpg", options);

In this example, if the original fonts used in the presentation are missing or unsupported on the system, the converter will automatically use "Arial" as the fallback font. This ensures that text is still displayed in a readable and consistent manner.

Include Speaker Notes in the Output

The SlidesViewOptions property in the ImageConverterOptions class gives you fine control over how slides are rendered when converting PowerPoint and OpenDocument presentations to images. This property allows you to specify options related to the display of speaker notes, comments, and other visual elements that may be part of the original presentation. The following example demonstrates how to use the SlidesViewOptions property to include speaker notes in the output JPEG images, positioning them below each slide.

using Slidize;

var options = new ImageConverterOptions
{
    SlidesViewOptions = new NotesCommentsViewOptions
    {
        NotesPosition = NotesPositions.BottomFull
    }
};

PresentationToJpegConverter.Process("presentation.pptx", "image.jpg", options);

In this example, the SlidesViewOptions property is used to configure the image output so that speaker notes are displayed beneath the slide in each output JPEG file. The NotesPosition is set to BottomFull, which means the notes will be fully displayed below the slide.

Include Comments in the Output

Sometimes, presentations contain comments that are relevant for review or feedback. You can include these comments in the generated images by adjusting the SlidesViewOptions accordingly.

using Slidize;

var options = new ImageConverterOptions
{
    SlidesViewOptions = new NotesCommentsViewOptions
    {
        CommentsPosition = CommentsPositions.Right
    }
};

PresentationToJpegConverter.Process("presentation.odp", "image.jpg", options);

In this example, the SlidesViewOptions property is used to include comments in the output images. The comments are positioned to the right of each slide using the CommentsPosition property, allowing reviewers or collaborators to see feedback alongside the slide content.