Guide for C#
Core Document Formats
Set PowerPoint Rendering Option
Additional Features

C# PowerPoint - Set Rendering Parameters in C#

Use C#.NET Code to Set PowerPoint Slide Rendering & Converting Options

Visual C#
Home > .NET Imaging SDK > C# > PowerPoint: Set Rendering Parameters
If this is your first time to use our DocImageSDK, we strongly suggest you reading How to Start first!

Overview of Setting PPT Rendering Options in C#.NET
Our .NET PowerPoint Document Conversion SDK empowers C# developers to set rendering parameters through C#.NET programming. No matter you use this SDK to render PowerPoint (2007 or above) slide into PDF document or other image formats (such as TIFF, JPEG, GIF, PNG, SVG and so on), you are able to set the rendering options based on practical needs. Generally, you are allowed to set image resolution, image size, batch conversion and page-by-page conversion parameters in the process of rendering PowerPoint document to other image and document formats in C#.NET application. Using VB.NET programming to set PPT document rendering options is also supported.
Related .net document control helps:
asp.net view text file in browser: ASP.NET Text file viewer in MVC, WebForms: Open, view, annotate, convert txt files in C# ASP.NET
asp.net mvc pdf editor: ASP.NET MVC PDF Viewer & Editor: view, annotate, redact, edit PDF document in C# ASP.NET MVC
asp.net pdf viewer: ASP.NET PDF Viewer Control: view, navigate, zoom Adobe PDF document in C# ASP.NET
asp.net annotate pdf: ASP.NET Annotate PDF Control: annotate, comment, markup PDF document online using ASP.NET C#
asp.net document viewer c#: ASP.NET Document Viewer using C#: Open, View, Annotate, Redact, Convert document files in ASP.NET using C#, HTML5, JQuer...
asp.net edit pdf image: ASP.NET PDF Image Edit Control: online insert, edit PDF images in C#
asp.net document viewer: EdgeDoc:ASP.NET Document Viewer C# Control: Open, view, annotate, redact, convert documents online in C#, VB.NET, AS...
In order to help you properly set PowerPoint (2007 or above) document rendering options in C#.NET class, we list all PowerPoint rendering options supported by our C#.NET PowerPoint Document Conversion SDK with brief introductions in the second part of this C#.NET guide page. Also, detailed APIs and C#.NET sample code are illustrated. In the end of this guide page, you will find more PowerPoint document slide rendering functions supported by PowerPoint Conversion SDK for C#.NET.
Options Can Be Set in C#.NET PowerPoint Rendering Process

Get Original PowerPoint Slide/Page Size in C#.NET

Using our C#.NET PowerPoint Document Conversion SDK, you are able to get the width and height of the original PowerPoint slide/page in inches during PowerPoint document rendering in C#.NET program. Easily, you may use "PPTX.GetWidth();" and "PPTX.GetHeight();" to realize this.

Control Image Size in C#.NET PowerPoint Rendering Process

During the process of rendering PowerPoint document in C#.NET, you are able to set rendered image size to get customized output image. In details, if you already know the target image dimension and the image size is not too big, then following APIs are supposed to be used in your C#.NET application. And sample code for this situation is offered below.
REImage ConvertToImage(Size targetSize);
Bitmap GetBitmap(float zoomValue);
Bitmap GetBitmap(Rectangle sourceRectangle, Size targetSize);
// load PowerPoint document
PPTXDocument doc = new PPTXDocument(@"c:\sample.pptx");

// compute zoom out factor
// get the first page as sample page
PPTXPage page = (PPTXPage)doc.GetPage(0);

// the orignial height and width are measured at 96 dpi
float originalWidth = page.GetWidth() * 96;
float originalHeight = page.GetHeight() * 96;

// set the size of target image
Size size = new Size(500, 500);

// get the image which sources the whole page and targets the specified size
page.GetBitmap(new Rectangle(0, 0, (int)originalWidth, (int)originalHeight), size);

// or specify dimension with a fixed ratio between the orignal and the target, with width set to the target width and height be adjusted accordingly
page.GetBitmap(size.Width / originalWidth);

Render and Convert (Big) PowerPoint Slide in Partitions

Developers are allowed to process PowerPoint document slide/page in partitions in C#.NET document rendering process if the slide/page is too big to handle using a single Bitmap Object due to memory limit and performance concern. In this situation, C# programmers should use the following APIs. Please try demo code below.
REImage CropImage(Rectangle sourceRegion, Size targetSize);
Bitmap GetBitmap(Rectangle sourceRectangle, Size targetSize);
void Draw(Graphics g, PointF loaction, Rectangle sourceRectangle, Size targetSize);
Note that, in the following C# sample code, the source region is in pixel and is measured using 96 default resolution. Moreover, the original dimension of PowerPoint slide/page can be computed using widthInPixel = page.GetWidth()*96 and heightInPixel= page.GetHeight()*96. For example, to convert the top half of the slide/page to image, you can set the source rectangle to start at (0, 0) and with the original width and half of the original height.
// load PowerPoint document
PPTXDocument doc = new PPTXDocument(@"c:\sample.pptx");

// compute zoom out factor
// get the first page as sample page
PPTXPage page = (PPTXPage)doc.GetPage(0);

// the orignial height and width are measured at 96 dpi of this page
float originalWidth = page.GetWidth() * 96;
float originalHeight = page.GetHeight() * 96;

// get the image which sources the left half of page and zooms in by a factor of 4
page.GetBitmap(new Rectangle(0, 0, (int)(originalWidth / 2), (int)originalHeight), new Size((int)(originalWidth / 2 * 4), (int)(originalHeight * 4)));

Convert the Whole PowerPoint Document to Images in C#.NET

As said above, C#.NET developers can set PowerPoint document rendering in batch mode or page-by-page. In the following code table, we will illustrated the mature .NET APIs that can be used to render and convert the whole PowerPoint document to images at a time.
void ConvertToImages(ImageType target, String directory, String fileName);
void ConvertToImages(ImageType targetType, float zoomValue, String directory, String fileName);
More PowerPoint Rendering Functions in C#.NET
In addition to setting PowerPoint document rendering options in C#.NET, you can use our .NET PowerPoint Doc Conversion Library SDK to realize other rendering implementations. Below is a list of some other functions.


Recommend this to Google+


RasterEdge.com is professional provider of ASP.NET MVC Document Viewer, ASP.NET PDF Viewer, MVC PDF Viewer document, content and imaging solutions, available for ASP.NET AJAX, Silverlight, Windows Forms as well as WPF. We are dedicated to provide powerful & profession imaging controls, PDF document, image to pdf files and components for capturing, viewing, processing, converting, compressing and stroing images, documents and more.

©2000-2017 Raster Edge.com