Introduction
The PresentationToTiffConverter class in Slidize.Plugins allows you to convert PowerPoint and OpenDocument presentations into high-quality TIFF images. TIFF (Tagged Image File Format) is commonly used for professional printing, archiving, and image processing because of its support for lossless compression and high fidelity.
In this article, we will explore how to use the PresentationToTiffConverter class, showing various examples using TiffConverterOptions for customization.
Basic PowerPoint to TIFF Conversion
In the simplest use case, you can convert a PowerPoint presentation into a series of TIFF images, where each slide is rendered as a separate image.
using Slidize;
PresentationToTiffConverter.Process("presentation.pptx", "image.tiff");
In this example, each slide from the PowerPoint presentation is converted into a separate TIFF file.
Customize Image Dimensions
You can customize the dimensions of the TIFF images by specifying custom values for ImageWidth and ImageHeight using TiffConverterOptions. This allows you to control the size of the output images.
using Slidize;
var options = new TiffConverterOptions
{
ImageWidth = 1024,
ImageHeight = 768
};
PresentationToTiffConverter.Process("presentation.pptx", "image.tiff", options);
In this example, each slide is rendered as a 1024x768 TIFF image, ensuring that the output size fits the specified dimensions.
Multipage TIFF Output
TIFF files can support multiple pages, allowing all slides from the presentation to be saved into a single multi-page TIFF file. This is useful for archiving or sharing the entire presentation as a single file.
using Slidize;
var options = new TiffConverterOptions
{
MultiPage = true
};
PresentationToTiffConverter.Process("presentation.pptx", "image.tiff", options);
Here, the MultiPage property is set to true, creating a single TIFF file that contains all the slides from the presentation as separate pages.
Compression Types for TIFF
The TiffConverterOptions class allows you to specify the compression type for the generated TIFF images. Supported compression types include LZW, CCITT3, CCITT4, and RLE, which help reduce file size.
using Slidize;
var options = new TiffConverterOptions
{
CompressionType = TiffCompressionTypes.LZW
};
PresentationToTiffConverter.Process("presentation.pptx", "image.tiff", options);
In this example, LZW compression is applied to reduce the file size without losing image quality, which is useful for storage and sharing.
Include Speaker Notes in the Output
The TiffConverterOptions class includes the SlidesViewOptions property, which allows you to include speaker notes in the output images. This is particularly useful for presentations that rely on speaker notes for context.
using Slidize;
var options = new TiffConverterOptions
{
SlidesViewOptions = new NotesCommentsViewOptions
{
NotesPosition = NotesPositions.BottomFull
}
};
PresentationToTiffConverter.Process("presentation.pptx", "image.tiff", options);
In this example, the speaker notes are included at the bottom of each slide, ensuring that the notes are part of the final TIFF images.
Set a Default Fallback Font
The TiffConverterOptions class provides a property called DefaultRegularFont, which allows you to specify a default font to be used in cases where the fonts in the original PowerPoint presentation are unavailable or unsupported on the system performing the conversion. This ensures that the text in the TIFF images remains consistent, even if the original fonts are missing.
using Slidize;
var options = new TiffConverterOptions
{
DefaultRegularFont = "Arial"
};
PresentationToTiffConverter.Process("presentation.pptx", "image.tiff", options);
In this example, the DefaultRegularFont property ensures that if the original presentation contains fonts that are not installed on the system, "Arial" will be used as a substitute. This is especially important for maintaining a consistent appearance when the exact fonts used in the presentation cannot be guaranteed across different systems.
Control Image Quality
The TiffConverterOptions class includes a property called PixelFormat, which allows you to control the color depth and format of the output TIFF images. The pixel format determines how many bits are used to represent each pixel in the image and how colors are encoded. By adjusting the PixelFormat, you can optimize the TIFF images for different use cases, such as reducing file size or enhancing color depth for printing.
using Slidize;
var options = new TiffConverterOptions
{
PixelFormat = ImagePixelFormat.Format24bppRgb
};
PresentationToTiffConverter.Process("presentation.pptx", "image.tiff", options);
In this example, the PowerPoint presentation (presentation.pptx) is converted to a TIFF image (image.tiff) using a 24-bit RGB pixel format to preserve high color quality.