C# PowerPoint Library
C# PowerPoint - Convert PowerPoint to PNG, BMP, and other raster images
Online C# Tutorial for How to Convert PowerPoint to Raster Images, .NET Graphics, and REImage
RasterEdge.com provides C# developers with mature PowerPoint document processing and rendering library SDK. Our XDoc.PowerPoint allows C# developers to perform high performance conversions from PowerPoint document to multiple image forms. Besides raster image Jpeg, images forms like Png, Bmp, Gif, .NET Graphics, and REImage (an intermediate class) are also supported. In the following parts, we provide some examples for these PowerPoint conversions.
How to convert Office PowerPoint to PNG, BMP images using C#?
Download XDoc.PowerPoint C# PPTX document library
Install C# PPTX library to convert Microsoft PowerPoint to raster images in .NET applications
You can use this sample code to convert PowerPoint file to Png image.
// Load a PowerPoint file.StringinputFilePath=Program.RootPath+"\\"+"1.pptx";PPTXDocumentdoc=newPPTXDocument(inputFilePath);// Get the first page of PowerPoint file.PPTXPagepage=(PPTXPage)doc.GetPage(0);// Convert the first PowerPoint page to a PNG file.page.ConvertToImage(ImageType.PNG,Program.RootPath+"Output.png");
C# Sample Code for PowerPoint to Bmp
Or use this piece of C# code to implement PowerPoint to Bmp conversion.
// Used to register all DLL assemblies.WorkRegistry.Reset();// Load a PowerPoint file.StringinputFilePath=Program.RootPath+"\\"+"1.pptx";PPTXDocumentdoc=newPPTXDocument(inputFilePath);// Get the first page of PowerPoint file.PPTXPagepage=(PPTXPage)doc.GetPage(0);// Convert the first PowerPoint page to a BMP file.page.ConvertToImage(ImageType.BMP,Program.RootPath+"\\Output.bmp");
C# Sample Code for PowerPoint to Gif
You can also directly change PowerPoint to Gif image file in C# program.
// Used to register all DLL assemblies.WorkRegistry.Reset();// Load a PowerPoint file.StringinputFilePath=Program.RootPath+"\\"+"1.pptx";PPTXDocumentdoc=newPPTXDocument(inputFilePath);// Get the first page of PowerPoint file.PPTXPagepage=(PPTXPage)doc.GetPage(0);// Convert the first PowerPoint page to a GIF file.page.ConvertToImage(ImageType.GIF,Program.RootPath+"\\Output.gif");
C# Sample Code for PowerPoint to REImage
Instead, you may render PowerPoint to REImage (an intermediate class) and then do further manipulations. In order to run the demo code, you need use namespace "RasterEdge.Imaging.Raster.Core";
// Used to register all DLL assemblies.WorkRegistry.Reset();// Load a PowerPoint file.StringinputFilePath=Program.RootPath+"\\"+"1.pptx";PPTXDocumentdoc=newPPTXDocument(inputFilePath);// Get the first page of PowerPoint.PPTXPagepage=(PPTXPage)doc.GetPage(0);// Convert the first page to a REImage object.REImageimage=newREImage(page.ConvertToImage());// Do something ...
C# Sample Code for PowerPoint to .NET Bitmap
Moreover, our SDK also allows you to render PowerPoint to .NET Bitmap in C# programming.
// Used to register all DLL assemblies.WorkRegistry.Reset();// Load a PowerPoint file.StringinputFilePath=Program.RootPath+"\\"+"1.pptx";PPTXDocumentdoc=newPPTXDocument(inputFilePath);// Get the first page of PowerPoint.PPTXPagepage=(PPTXPage)doc.GetPage(0);// Render the page to a Bitmap with default setting.Bitmapbitmap1=page.GetBitmap();bitmap1.Save(inputFilePath+"_1.bmp");// ...// Enlarge the page with factor 2.floatzoomRatio=2.0F;Bitmapbitmap2=page.GetBitmap(zoomRatio);bitmap2.Save(inputFilePath+"_2.bmp");// ...// Render the page with a resolution of 300 dpi.inttargetResolution=300;Bitmapbitmap3=page.GetBitmap(targetResolution);bitmap3.Save(inputFilePath+"_3.bmp");// ...