Load, render, view, convert PPTX document using C#
August 03, 2026
/// <summary>
/// Shows information about PPTX document from metadata tree.
/// </summary>
/// <param name="pptxFilename">A name of PPTX file.</param>
public static void ShowPptxDocumentInfoFromMetadataTree(string pptxFilename)
{
// create image collection
using (Vintasoft.Imaging.ImageCollection images = new Vintasoft.Imaging.ImageCollection())
{
// add PPTX document to the image collection
images.Add(pptxFilename);
// if image collection has images/pages
if (images.Count > 0)
{
// get the first image/page
Vintasoft.Imaging.VintasoftImage firstImage = images[0];
// get PptxDocumentMetadata object from the metadata tree of PPTX decoder
Vintasoft.Imaging.Metadata.PptxDocumentMetadata pptxDocumentMetadata =
firstImage.SourceInfo.Decoder.GetDocumentMetadata() as Vintasoft.Imaging.Metadata.PptxDocumentMetadata;
// if PptxDocumentMetadata object is found
if (pptxDocumentMetadata != null)
{
// get PPTX document from PptxDocumentMetadata object
Vintasoft.Imaging.Office.OpenXml.Pptx.PptxDocument pptxDocument =
pptxDocumentMetadata.Document;
// show information about PPTX document
System.Console.WriteLine(string.Format("PPTX document \"{0}\" information:", pptxFilename));
System.Console.WriteLine(string.Format(" - Page count: {0}", pptxDocument.Pages.Count));
System.Console.WriteLine(string.Format(" - Category: {0}", pptxDocument.DocumentInformation.Category));
System.Console.WriteLine(string.Format(" - ContentStatus: {0}", pptxDocument.DocumentInformation.ContentStatus));
System.Console.WriteLine(string.Format(" - ContentType: {0}", pptxDocument.DocumentInformation.ContentType));
System.Console.WriteLine(string.Format(" - Created: {0}", pptxDocument.DocumentInformation.Created));
System.Console.WriteLine(string.Format(" - Creator: {0}", pptxDocument.DocumentInformation.Creator));
System.Console.WriteLine(string.Format(" - Description: {0}", pptxDocument.DocumentInformation.Description));
System.Console.WriteLine(string.Format(" - Identifier: {0}", pptxDocument.DocumentInformation.Identifier));
System.Console.WriteLine(string.Format(" - Keywords: {0}", pptxDocument.DocumentInformation.Keywords));
System.Console.WriteLine(string.Format(" - Language: {0}", pptxDocument.DocumentInformation.Language));
System.Console.WriteLine(string.Format(" - LastModifiedBy: {0}", pptxDocument.DocumentInformation.LastModifiedBy));
System.Console.WriteLine(string.Format(" - LastPrinted: {0}", pptxDocument.DocumentInformation.LastPrinted));
System.Console.WriteLine(string.Format(" - Modified: {0}", pptxDocument.DocumentInformation.Modified));
System.Console.WriteLine(string.Format(" - Revision: {0}", pptxDocument.DocumentInformation.Revision));
System.Console.WriteLine(string.Format(" - Subject: {0}", pptxDocument.DocumentInformation.Subject));
System.Console.WriteLine(string.Format(" - Title: {0}", pptxDocument.DocumentInformation.Title));
System.Console.WriteLine(string.Format(" - Version: {0}", pptxDocument.DocumentInformation.Version));
}
}
// dispose images
images.ClearAndDisposeItems();
}
}
/// <summary>
/// Renders pages of PPTX document.
/// </summary>
/// <param name="pptxFilename">A name of PPTX file.</param>
public static void RenderPagesOfPptxDocument(string pptxFilename)
{
// create image collection
using (Vintasoft.Imaging.ImageCollection images = new Vintasoft.Imaging.ImageCollection())
{
// add PPTX document to the image collection
images.Add(pptxFilename);
// for each image in collection
for (int i = 0; i < images.Count; i++)
{
// get image
Vintasoft.Imaging.VintasoftImage image = images[i];
// save image to a PNG file
image.Save(string.Format("page{0}.png", i));
}
// dispose images
images.ClearAndDisposeItems();
}
}
public static void ExtractPptxPageTextFromMetadataTree(string pptxFilename)
{
// create image collection
using (Vintasoft.Imaging.ImageCollection images = new Vintasoft.Imaging.ImageCollection())
{
// add PPTX document to the image collection
images.Add(pptxFilename);
// for each image in collection
for (int i = 0; i < images.Count; i++)
{
// get image
Vintasoft.Imaging.VintasoftImage image = images[i];
// get PptxPageTextRegionMetadata object from the metadata tree of image
Vintasoft.Imaging.Metadata.PptxPageTextRegionMetadata pptxPageTextRegionMetadata =
image.Metadata.MetadataTree.FindChildNode<Vintasoft.Imaging.Metadata.PptxPageTextRegionMetadata>();
// if PptxPageTextRegionMetadata object is found
if (pptxPageTextRegionMetadata != null)
{
// get the text region from the PptxPageTextRegionMetadata object
Vintasoft.Imaging.Text.TextRegion textregion = pptxPageTextRegionMetadata.GetTextRegion();
// if text region is found
if (textregion != null)
{
// show information about text region
System.Console.WriteLine(string.Format("Page {0}, Text={1}", i, textregion.TextContent));
}
}
}
// dispose images
images.ClearAndDisposeItems();
}
}
...
// open PPTX file in WinForms image viewer
imageViewer1.Images.Add("PptxTestDocument.pptx");
...
...
// open PPTX file in WPF image viewer
wpfImageViewer1.Images.Add("PptxTestDocument.pptx");
...
...
var imageViewer1 = new Vintasoft.Imaging.UI.WebImageViewerJS("WebImageViewer1");
// open PPTX file in web image viewer
imageViewer1.get_Images().openFile("PptxTestDocument.pptx");
...
...
// create the document viewer
var docViewer1 = new Vintasoft.Imaging.DocumentViewer.WebDocumentViewerJS(docViewerSettings);
...
// open PPTX file in web document viewer
docViewer1.openFile("PptxTestDocument.pptx");
...
/// <summary>
/// Converts PPTX document to a PDF document using ImageCollection and PdfEncoder classes.
/// </summary>
public static void ConvertPptxToPdf(string pptxFileName, string pdfFileName)
{
// specify that VintaSoft Imaging .NET SDK should use GDI+ for drawing of 2D graphics
Vintasoft.Imaging.Drawing.Gdi.GdiGraphicsFactory.SetAsDefault();
// specify that VintaSoft Imaging .NET SDK should use SkiaSharp for drawing of 2D graphics
//Vintasoft.Imaging.Drawing.SkiaSharp.SkiaSharpDrawingFactory.SetAsDefault();
// create image collection
using (Vintasoft.Imaging.ImageCollection imageCollection = new Vintasoft.Imaging.ImageCollection())
{
// add PPTX document to collection
imageCollection.Add(pptxFileName);
// create pdfEncoder
using (Vintasoft.Imaging.Codecs.Encoders.PdfEncoder pdfEncoder =
new Vintasoft.Imaging.Codecs.Encoders.PdfEncoder(true))
{
// set comression for image resources
pdfEncoder.Settings.Compression = Vintasoft.Imaging.Codecs.Encoders.PdfImageCompression.Jpeg;
// save images of image collection to PDF document using PdfEncoder
imageCollection.SaveSync(pdfFileName, pdfEncoder);
}
// dispose images
imageCollection.ClearAndDisposeItems();
}
}
/// <summary>
/// Converts PPTX document to TIFF file using ImageCollection and TiffEncoder classes.
/// PPTX document is rendered with specified resolution.
/// </summary>
public static void ConvertPptxToTiff(string pptxFileName, string tiffFileName, float dpi)
{
// specify that VintaSoft Imaging .NET SDK should use GDI+ for drawing of 2D graphics
Vintasoft.Imaging.Drawing.Gdi.GdiGraphicsFactory.SetAsDefault();
// specify that VintaSoft Imaging .NET SDK should use SkiaSharp for drawing of 2D graphics
//Vintasoft.Imaging.Drawing.SkiaSharp.SkiaSharpDrawingFactory.SetAsDefault();
// create image collection
using (Vintasoft.Imaging.ImageCollection imageCollection = new Vintasoft.Imaging.ImageCollection())
{
// add PPTX document to collection
imageCollection.Add(pptxFileName);
// set rendering settings
imageCollection.SetRenderingSettings(new Vintasoft.Imaging.Codecs.Decoders.RenderingSettings(dpi, dpi));
// create TiffEncoder
using (Vintasoft.Imaging.Codecs.Encoders.TiffEncoder tiffEncoder =
new Vintasoft.Imaging.Codecs.Encoders.TiffEncoder(true))
{
// set TIFF compression to Zip
tiffEncoder.Settings.Compression =
Vintasoft.Imaging.Codecs.ImageFiles.Tiff.TiffCompression.Zip;
// save images of image collection to TIFF file using TiffEncoder
imageCollection.SaveSync(tiffFileName, tiffEncoder);
}
// dispose images
imageCollection.ClearAndDisposeItems();
}
}
/// <summary>
/// Converts pages of PPTX document to PNG files.
/// </summary>
public static void ConvertPptxToPng(string pptxFileName)
{
// specify that VintaSoft Imaging .NET SDK should use GDI+ for drawing of 2D graphics
Vintasoft.Imaging.Drawing.Gdi.GdiGraphicsFactory.SetAsDefault();
// specify that VintaSoft Imaging .NET SDK should use SkiaSharp for drawing of 2D graphics
//Vintasoft.Imaging.Drawing.SkiaSharp.SkiaSharpDrawingFactory.SetAsDefault();
// create image collection
using (Vintasoft.Imaging.ImageCollection images = new Vintasoft.Imaging.ImageCollection())
{
// add PPTX document to the image collection
images.Add(pptxFileName);
// create PNG encoder
using (Vintasoft.Imaging.Codecs.Encoders.PngEncoder pngEncoder =
new Vintasoft.Imaging.Codecs.Encoders.PngEncoder())
{
// for each page in PPTX document
for (int i = 0; i < images.Count; i++)
{
// save rendered image to a PNG file
images[i].Save(string.Format("page{0}.png", i), pngEncoder);
}
}
// dispose images
images.ClearAndDisposeItems();
}
}
/// <summary>
/// Converts PPTX document to the SVG files using ImageCollection and SvgEncoder classes.
/// </summary>
public static void ConvertPptxToSvg(string pptxFileName)
{
// specify that VintaSoft Imaging .NET SDK should use GDI+ for drawing of 2D graphics
Vintasoft.Imaging.Drawing.Gdi.GdiGraphicsFactory.SetAsDefault();
// specify that VintaSoft Imaging .NET SDK should use SkiaSharp for drawing of 2D graphics
//Vintasoft.Imaging.Drawing.SkiaSharp.SkiaSharpDrawingFactory.SetAsDefault();
// create image collection
using (Vintasoft.Imaging.ImageCollection images = new Vintasoft.Imaging.ImageCollection())
{
// add PPTX document to the image collection
images.Add(pptxFileName);
// create SVG encoder
using (Vintasoft.Imaging.Codecs.Encoders.SvgEncoder svgEncoder =
new Vintasoft.Imaging.Codecs.Encoders.SvgEncoder())
{
// specify that SVG encoder should compress embedded image using PNG compression
svgEncoder.Settings.EmbeddedImageEncoder = new Vintasoft.Imaging.Codecs.Encoders.PngEncoder();
// for each page in PPTX document
for (int i = 0; i < images.Count; i++)
{
// save page to SVG file
images[i].Save(string.Format("page{0}.svg", i), svgEncoder);
}
}
// dispose images
images.ClearAndDisposeItems();
}
}