PowerPoint to Image Conversion in UWP | Syncfusion Blogs
Live Chat Icon For mobile
Live Chat Icon
Popular Categories.NET  (173).NET Core  (29).NET MAUI  (203)Angular  (107)ASP.NET  (51)ASP.NET Core  (82)ASP.NET MVC  (89)Azure  (40)Black Friday Deal  (1)Blazor  (211)BoldSign  (13)DocIO  (24)Essential JS 2  (106)Essential Studio  (200)File Formats  (65)Flutter  (132)JavaScript  (219)Microsoft  (118)PDF  (81)Python  (1)React  (98)Streamlit  (1)Succinctly series  (131)Syncfusion  (897)TypeScript  (33)Uno Platform  (3)UWP  (4)Vue  (45)Webinar  (50)Windows Forms  (61)WinUI  (68)WPF  (157)Xamarin  (161)XlsIO  (35)Other CategoriesBarcode  (5)BI  (29)Bold BI  (8)Bold Reports  (2)Build conference  (8)Business intelligence  (55)Button  (4)C#  (146)Chart  (127)Cloud  (15)Company  (443)Dashboard  (8)Data Science  (3)Data Validation  (8)DataGrid  (63)Development  (618)Doc  (8)DockingManager  (1)eBook  (99)Enterprise  (22)Entity Framework  (5)Essential Tools  (14)Excel  (39)Extensions  (22)File Manager  (6)Gantt  (18)Gauge  (12)Git  (5)Grid  (31)HTML  (13)Installer  (2)Knockout  (2)Language  (1)LINQPad  (1)Linux  (2)M-Commerce  (1)Metro Studio  (11)Mobile  (501)Mobile MVC  (9)OLAP server  (1)Open source  (1)Orubase  (12)Partners  (21)PDF viewer  (42)Performance  (12)PHP  (2)PivotGrid  (4)Predictive Analytics  (6)Report Server  (3)Reporting  (10)Reporting / Back Office  (11)Rich Text Editor  (12)Road Map  (12)Scheduler  (52)Security  (3)SfDataGrid  (9)Silverlight  (21)Sneak Peek  (31)Solution Services  (4)Spreadsheet  (11)SQL  (10)Stock Chart  (1)Surface  (4)Tablets  (5)Theme  (12)Tips and Tricks  (112)UI  (381)Uncategorized  (68)Unix  (2)User interface  (68)Visual State Manager  (2)Visual Studio  (31)Visual Studio Code  (17)Web  (582)What's new  (323)Windows 8  (19)Windows App  (2)Windows Phone  (15)Windows Phone 7  (9)WinRT  (26)

PowerPoint to Image Conversion in UWP

Syncfusion is excited to share that PowerPoint to image conversion is now available for UWP applications from 2018 Volume 1 (version 16.1) onward. Before, Essential Presentation supported PowerPoint to image conversion in Windows Forms, WPF, ASP.NET, and ASP.NET MVC. Now, you can convert PowerPoint presentations (PPTX) to images in UWP. This helps with viewing and printing a PowerPoint presentation from Windows desktop and mobile environments.

The following slide elements are supported in PowerPoint-to-image conversion:

  • Text
  • Bullets and numbering
  • Shapes
  • Tables
  • Charts
  • Images
  • SmartArt diagrams
  • Formatting

Experience the magic of Syncfusion’s C# PowerPoint Library. Witness your ideas come to life with its Microsoft PowerPoint-like editing, conversion, and formatting options.

Converting a PowerPoint slide to a high-quality image

Let’s learn how to convert a PowerPoint slide to an image in UWP.

Prerequisites:

  • Windows 10
  • Visual Studio 2015 or 2017
  • Windows 10 SDK

Step 1: Create a Blank App (Universal Windows) and name it PowerPointDemo.

Step 2: Choose the target version (Essential Presentation is supported from the minimum version).

Step 3: Add the Syncfusion.Presentation.UWP NuGet package as a reference to the project from the Syncfusion UWP NuGet feed. For more information about adding a NuGet feed in Visual Studio and installing NuGet packages, refer to our documentation.

You can also install this package from the NuGet package manager console by executing the following command.

Install-package Syncfusion.Presentation.UWP -source http://nuget.syncfusion.com/nuget_universalwindows/nuget/getsyncfusionpackages/universalwindows

The features of Syncfusion’s PowerPoint Library are documented with clear code examples for multiple scenarios.

Step 4: Add an input PowerPoint document to the asset folder. Right-click the PowerPoint document, select Properties, and set its build action as Embedded resource.

Step 5: Add a button in the MainPage.xaml.

<Page
    x:Class="PresentationDemo.MainPage"
    >="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    >="http://schemas.microsoft.com/expression/blend/2008"
    >="http://schemas.microsoft.com/winfx/2006/xaml"
    >="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d">
    <Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
        <Button Name="ConvertPPTX" HorizontalAlignment="Center" VerticalAlignment="Center" Content="Convert" Click="ConvertPPTX_Click"></Button>
    </Grid>
</Page>

Step 6: Add the following code in the ConvertPPTX_Click method in the MainPage.xaml.cs file to retrieve the embedded PowerPoint file as stream and convert the PowerPoint slide to an image using the SaveAsImageAsync method of ISlide interface. 

Note: It is mandatory to instantiate the ChartToImageConverter property of IPresentation interface, otherwise the charts will be left blank in the resultant image.

//Get the embedded PowerPoint presentation. You can use a file picker to read a file instead.
Assembly assembly = this.GetType().GetTypeInfo().Assembly;
using (Stream stream =    assembly.GetManifestResourceStream("PowerPointDemo.Assets.Template.pptx"))
{
        //Load the presentation file from stream.
        using (IPresentation _presentation = Presentation.Open(stream))
        {
            //Initialize ‘ChartToImageConverter’ to convert the charts in slides
           _presentation.ChartToImageConverter = new ChartToImageConverter();

            //Get the first slide in the presentation.
            ISlide slide = _presentation.Slides[0];

            //Create a storage file to save the converted image.
            StorageFile sampleFile = await KnownFolders.PicturesLibrary.CreateFileAsync("Slide1.png", CreationCollisionOption.ReplaceExisting);

            //Convert the slide to an image.
            using (var imageStream = await sampleFile.OpenStreamForWriteAsync())
            {
                await slide.SaveAsImageAsync(imageStream);
            }
        }
}

Syncfusion’s PowerPoint Framework is cross-platform compatible. Explore its features by platform with interactive demos.

Converting a PowerPoint slide to a thumbnail image

You can also generate images in custom sizes by enabling rendering options. The below code example shows how to convert a PowerPoint slide to a thumbnail image.

//Set the rendering options to scale the image at 0.25. The default scaling factor is 1.
RenderingOptions options = new RenderingOptions() { ScaleX = 0.25f, ScaleY = 0.25f };
//Convert the slide to an image.
using (var imageStream = await sampleFile.OpenStreamForWriteAsync())
{
await slide.SaveAsImageAsync(imageStream);
}

You can also print a PowerPoint presentation by printing the converted images. The images can be printed using the UWP native printer APIs.

A simple PowerPoint viewer UWP application can be downloaded, showing you how to display a slide and print the PowerPoint presentation.

Simple PowerPoint viewer application’s desktop and mobile views

Step into a world of boundlessly creative presentations with Syncfusion’s C# PowerPoint Library!

Conclusion

With PowerPoint presentation-to-image conversion, you can achieve the below functionality in UWP applications.

  • Display PowerPoint slides.
  • Print a PowerPoint presentation.

You can convert existing PowerPoint slides or create a slide from scratch and then convert it to an image as required.

If you are new to our Presentation library, we highly recommend you follow our Getting Started guide.

If you’re already a Syncfusion user, you can download the product setup on Direct-Trac. If you’re not yet a Syncfusion user, you can download a free, 30-day trial.

If you have any questions or require clarification about this feature, please let us know in the comments below. You can also contact us through our support forum or Direct-Trac. We are happy to assist you!

Tags:

Share this post:

Popular Now

Be the first to get updates

Subscribe RSS feed

Be the first to get updates

Subscribe RSS feed