Skip to content

Commit 5b06aee

Browse files
Task-895640-Blog-Convert-PowerPoint-to-Images
1 parent 0ab25ce commit 5b06aee

33 files changed

+758
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio Version 17
4+
VisualStudioVersion = 17.12.35527.113 d17.12
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "convert-entire-powerpoint-to-images", "convert-entire-powerpoint-to-images\convert-entire-powerpoint-to-images.csproj", "{1D26AC76-3D3E-4626-929E-D0936F49C5CB}"
7+
EndProject
8+
Global
9+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
10+
Debug|Any CPU = Debug|Any CPU
11+
Release|Any CPU = Release|Any CPU
12+
EndGlobalSection
13+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
14+
{1D26AC76-3D3E-4626-929E-D0936F49C5CB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15+
{1D26AC76-3D3E-4626-929E-D0936F49C5CB}.Debug|Any CPU.Build.0 = Debug|Any CPU
16+
{1D26AC76-3D3E-4626-929E-D0936F49C5CB}.Release|Any CPU.ActiveCfg = Release|Any CPU
17+
{1D26AC76-3D3E-4626-929E-D0936F49C5CB}.Release|Any CPU.Build.0 = Release|Any CPU
18+
EndGlobalSection
19+
GlobalSection(SolutionProperties) = preSolution
20+
HideSolutionNode = FALSE
21+
EndGlobalSection
22+
EndGlobal
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<?xml version="1.0" encoding="utf-8" ?>
2+
<configuration>
3+
<startup>
4+
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8" />
5+
</startup>
6+
</configuration>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
using Syncfusion.Drawing;
2+
using Syncfusion.OfficeChartToImageConverter;
3+
using Syncfusion.Presentation;
4+
using System.IO;
5+
6+
namespace convert_entire_powerpoint_to_images
7+
{
8+
internal class Program
9+
{
10+
static void Main(string[] args)
11+
{
12+
//Open the file as Stream.
13+
using (FileStream fileStream = new FileStream(Path.GetFullPath(@"../../Template.pptx"), FileMode.Open, FileAccess.Read))
14+
{
15+
//Load an existing PowerPoint presentation.
16+
using (IPresentation pptxDoc = Presentation.Open(fileStream))
17+
{
18+
//Initialize ChartToImageConverter
19+
pptxDoc.ChartToImageConverter = new ChartToImageConverter();
20+
//Convert PowerPoint to images.
21+
Stream[] images = pptxDoc.RenderAsImages((ImageFormat)ImageType.Metafile);
22+
//Save the images to file.
23+
for (int i = 0; i < images.Length; i++)
24+
{
25+
using (Stream stream = images[i])
26+
{
27+
using (FileStream fileStreamOutput = File.Create(Path.GetFullPath("../../Image-" + i + ".jpg")))
28+
{
29+
stream.CopyTo(fileStreamOutput);
30+
}
31+
}
32+
}
33+
}
34+
}
35+
}
36+
}
37+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
using System.Reflection;
2+
using System.Runtime.CompilerServices;
3+
using System.Runtime.InteropServices;
4+
5+
// General Information about an assembly is controlled through the following
6+
// set of attributes. Change these attribute values to modify the information
7+
// associated with an assembly.
8+
[assembly: AssemblyTitle("convert-entire-powerpoint-to-images")]
9+
[assembly: AssemblyDescription("")]
10+
[assembly: AssemblyConfiguration("")]
11+
[assembly: AssemblyCompany("")]
12+
[assembly: AssemblyProduct("convert-entire-powerpoint-to-images")]
13+
[assembly: AssemblyCopyright("Copyright © 2024")]
14+
[assembly: AssemblyTrademark("")]
15+
[assembly: AssemblyCulture("")]
16+
17+
// Setting ComVisible to false makes the types in this assembly not visible
18+
// to COM components. If you need to access a type in this assembly from
19+
// COM, set the ComVisible attribute to true on that type.
20+
[assembly: ComVisible(false)]
21+
22+
// The following GUID is for the ID of the typelib if this project is exposed to COM
23+
[assembly: Guid("1d26ac76-3d3e-4626-929e-d0936f49c5cb")]
24+
25+
// Version information for an assembly consists of the following four values:
26+
//
27+
// Major Version
28+
// Minor Version
29+
// Build Number
30+
// Revision
31+
//
32+
[assembly: AssemblyVersion("1.0.0.0")]
33+
[assembly: AssemblyFileVersion("1.0.0.0")]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
4+
<PropertyGroup>
5+
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
6+
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
7+
<ProjectGuid>{1D26AC76-3D3E-4626-929E-D0936F49C5CB}</ProjectGuid>
8+
<OutputType>Exe</OutputType>
9+
<RootNamespace>convert_entire_powerpoint_to_images</RootNamespace>
10+
<AssemblyName>convert-entire-powerpoint-to-images</AssemblyName>
11+
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
12+
<FileAlignment>512</FileAlignment>
13+
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
14+
<Deterministic>true</Deterministic>
15+
</PropertyGroup>
16+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
17+
<PlatformTarget>AnyCPU</PlatformTarget>
18+
<DebugSymbols>true</DebugSymbols>
19+
<DebugType>full</DebugType>
20+
<Optimize>false</Optimize>
21+
<OutputPath>bin\Debug\</OutputPath>
22+
<DefineConstants>DEBUG;TRACE</DefineConstants>
23+
<ErrorReport>prompt</ErrorReport>
24+
<WarningLevel>4</WarningLevel>
25+
</PropertyGroup>
26+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
27+
<PlatformTarget>AnyCPU</PlatformTarget>
28+
<DebugType>pdbonly</DebugType>
29+
<Optimize>true</Optimize>
30+
<OutputPath>bin\Release\</OutputPath>
31+
<DefineConstants>TRACE</DefineConstants>
32+
<ErrorReport>prompt</ErrorReport>
33+
<WarningLevel>4</WarningLevel>
34+
</PropertyGroup>
35+
<ItemGroup>
36+
<Reference Include="Syncfusion.Compression.Base, Version=28.1462.33.0, Culture=neutral, PublicKeyToken=3d67ed1f87d44c89, processorArchitecture=MSIL">
37+
<HintPath>..\packages\Syncfusion.Compression.Base.28.1.33\lib\net462\Syncfusion.Compression.Base.dll</HintPath>
38+
</Reference>
39+
<Reference Include="Syncfusion.Licensing, Version=28.1462.33.0, Culture=neutral, PublicKeyToken=632609b4d040f6b4, processorArchitecture=MSIL">
40+
<HintPath>..\packages\Syncfusion.Licensing.28.1.33\lib\net462\Syncfusion.Licensing.dll</HintPath>
41+
</Reference>
42+
<Reference Include="Syncfusion.OfficeChart.Base, Version=28.1462.33.0, Culture=neutral, PublicKeyToken=3d67ed1f87d44c89, processorArchitecture=MSIL">
43+
<HintPath>..\packages\Syncfusion.OfficeChart.Base.28.1.33\lib\net462\Syncfusion.OfficeChart.Base.dll</HintPath>
44+
</Reference>
45+
<Reference Include="Syncfusion.OfficeChartToImageConverter.Wpf, Version=28.1462.33.0, Culture=neutral, PublicKeyToken=3d67ed1f87d44c89, processorArchitecture=MSIL">
46+
<HintPath>..\packages\Syncfusion.OfficeChartToImageConverter.WinForms.28.1.33\lib\net462\Syncfusion.OfficeChartToImageConverter.Wpf.dll</HintPath>
47+
</Reference>
48+
<Reference Include="Syncfusion.Presentation.Base, Version=28.1462.33.0, Culture=neutral, PublicKeyToken=3d67ed1f87d44c89, processorArchitecture=MSIL">
49+
<HintPath>..\packages\Syncfusion.Presentation.WinForms.28.1.33\lib\net462\Syncfusion.Presentation.Base.dll</HintPath>
50+
</Reference>
51+
<Reference Include="Syncfusion.SfChart.WPF, Version=28.1462.33.0, Culture=neutral, PublicKeyToken=3d67ed1f87d44c89, processorArchitecture=MSIL">
52+
<HintPath>..\packages\Syncfusion.SfChart.WPF.28.1.33\lib\net462\Syncfusion.SfChart.WPF.dll</HintPath>
53+
</Reference>
54+
<Reference Include="System" />
55+
<Reference Include="System.Core" />
56+
<Reference Include="System.Drawing" />
57+
<Reference Include="System.Xml.Linq" />
58+
<Reference Include="System.Data.DataSetExtensions" />
59+
<Reference Include="Microsoft.CSharp" />
60+
<Reference Include="System.Data" />
61+
<Reference Include="System.Net.Http" />
62+
<Reference Include="System.Xml" />
63+
</ItemGroup>
64+
<ItemGroup>
65+
<Compile Include="Program.cs" />
66+
<Compile Include="Properties\AssemblyInfo.cs" />
67+
</ItemGroup>
68+
<ItemGroup>
69+
<None Include="App.config" />
70+
<None Include="packages.config" />
71+
</ItemGroup>
72+
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
73+
</Project>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<packages>
3+
<package id="Syncfusion.Compression.Base" version="28.1.33" targetFramework="net48" />
4+
<package id="Syncfusion.Licensing" version="28.1.33" targetFramework="net48" />
5+
<package id="Syncfusion.OfficeChart.Base" version="28.1.33" targetFramework="net48" />
6+
<package id="Syncfusion.OfficeChartToImageConverter.WinForms" version="28.1.33" targetFramework="net48" />
7+
<package id="Syncfusion.Presentation.WinForms" version="28.1.33" targetFramework="net48" />
8+
<package id="Syncfusion.SfChart.WPF" version="28.1.33" targetFramework="net48" />
9+
</packages>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio Version 17
4+
VisualStudioVersion = 17.6.33829.357
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "convert-entire-powerpoint-to-images", "convert-entire-powerpoint-to-images\convert-entire-powerpoint-to-images.csproj", "{F700D3CC-9F5B-4BE8-8EFF-6902E14FE96D}"
7+
EndProject
8+
Global
9+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
10+
Debug|Any CPU = Debug|Any CPU
11+
Release|Any CPU = Release|Any CPU
12+
EndGlobalSection
13+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
14+
{F700D3CC-9F5B-4BE8-8EFF-6902E14FE96D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15+
{F700D3CC-9F5B-4BE8-8EFF-6902E14FE96D}.Debug|Any CPU.Build.0 = Debug|Any CPU
16+
{F700D3CC-9F5B-4BE8-8EFF-6902E14FE96D}.Release|Any CPU.ActiveCfg = Release|Any CPU
17+
{F700D3CC-9F5B-4BE8-8EFF-6902E14FE96D}.Release|Any CPU.Build.0 = Release|Any CPU
18+
EndGlobalSection
19+
GlobalSection(SolutionProperties) = preSolution
20+
HideSolutionNode = FALSE
21+
EndGlobalSection
22+
GlobalSection(ExtensibilityGlobals) = postSolution
23+
SolutionGuid = {C3F11A05-D51E-4786-9786-C6BBE869DECD}
24+
EndGlobalSection
25+
EndGlobal
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
using Syncfusion.Presentation;
2+
using Syncfusion.PresentationRenderer;
3+
4+
namespace convert_entire_powerpoint_to_images
5+
{
6+
internal class Program
7+
{
8+
static void Main(string[] args)
9+
{
10+
//Open the file as Stream.
11+
using (FileStream fileStream = new FileStream(Path.GetFullPath(@"../../../Template.pptx"), FileMode.Open, FileAccess.Read))
12+
{
13+
//Load an existing PowerPoint presentation.
14+
using (IPresentation pptxDoc = Presentation.Open(fileStream))
15+
{
16+
//Initialize PresentationRenderer.
17+
pptxDoc.PresentationRenderer = new PresentationRenderer();
18+
//Convert PowerPoint to images.
19+
Stream[] images = pptxDoc.RenderAsImages(ExportImageFormat.Jpeg);
20+
//Save the images to file.
21+
for (int i = 0; i < images.Length; i++)
22+
{
23+
using (Stream stream = images[i])
24+
{
25+
using (FileStream fileStreamOutput = File.Create(Path.GetFullPath("../../../Image-" + i + ".jpg")))
26+
{
27+
stream.CopyTo(fileStreamOutput);
28+
}
29+
}
30+
}
31+
}
32+
}
33+
}
34+
}
35+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<OutputType>Exe</OutputType>
5+
<TargetFramework>net8.0</TargetFramework>
6+
<RootNamespace>convert_entire_powerpoint_to_images</RootNamespace>
7+
<ImplicitUsings>enable</ImplicitUsings>
8+
<Nullable>enable</Nullable>
9+
</PropertyGroup>
10+
11+
<ItemGroup>
12+
<PackageReference Include="Syncfusion.PresentationRenderer.Net.Core" Version="*" />
13+
</ItemGroup>
14+
15+
</Project>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio Version 17
4+
VisualStudioVersion = 17.12.35527.113 d17.12
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "convert-powerpoint-slide-to-image", "convert-powerpoint-slide-to-image\convert-powerpoint-slide-to-image.csproj", "{84FAA810-55ED-43B0-A597-2F38C8A30AAC}"
7+
EndProject
8+
Global
9+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
10+
Debug|Any CPU = Debug|Any CPU
11+
Release|Any CPU = Release|Any CPU
12+
EndGlobalSection
13+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
14+
{84FAA810-55ED-43B0-A597-2F38C8A30AAC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15+
{84FAA810-55ED-43B0-A597-2F38C8A30AAC}.Debug|Any CPU.Build.0 = Debug|Any CPU
16+
{84FAA810-55ED-43B0-A597-2F38C8A30AAC}.Release|Any CPU.ActiveCfg = Release|Any CPU
17+
{84FAA810-55ED-43B0-A597-2F38C8A30AAC}.Release|Any CPU.Build.0 = Release|Any CPU
18+
EndGlobalSection
19+
GlobalSection(SolutionProperties) = preSolution
20+
HideSolutionNode = FALSE
21+
EndGlobalSection
22+
EndGlobal
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<?xml version="1.0" encoding="utf-8" ?>
2+
<configuration>
3+
<startup>
4+
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8" />
5+
</startup>
6+
</configuration>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
using Syncfusion.Drawing;
2+
using Syncfusion.OfficeChartToImageConverter;
3+
using Syncfusion.Presentation;
4+
using System.IO;
5+
6+
namespace convert_powerpoint_slide_to_image
7+
{
8+
internal class Program
9+
{
10+
static void Main(string[] args)
11+
{
12+
//Open the file as Stream.
13+
using (FileStream inputStream = new FileStream(Path.GetFullPath(@"../../Template.pptx"), FileMode.Open, FileAccess.Read, FileShare.ReadWrite))
14+
{
15+
//Load an existing PowerPoint presentation.
16+
using (IPresentation pptxDoc = Presentation.Open(inputStream))
17+
{
18+
//Initialize ChartToImageConverter.
19+
pptxDoc.ChartToImageConverter = new ChartToImageConverter();
20+
//Convert the first slide of the PowerPoint to an image.
21+
using (Stream stream = pptxDoc.Slides[0].ConvertToImage((ImageFormat)ImageType.Metafile))
22+
{
23+
//Save the image stream to file.
24+
using (FileStream fileStreamOutput = File.Create(Path.GetFullPath(@"../../Image.jpg")))
25+
{
26+
stream.CopyTo(fileStreamOutput);
27+
}
28+
}
29+
}
30+
}
31+
}
32+
}
33+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
using System.Reflection;
2+
using System.Runtime.CompilerServices;
3+
using System.Runtime.InteropServices;
4+
5+
// General Information about an assembly is controlled through the following
6+
// set of attributes. Change these attribute values to modify the information
7+
// associated with an assembly.
8+
[assembly: AssemblyTitle("convert-powerpoint-slide-to-image")]
9+
[assembly: AssemblyDescription("")]
10+
[assembly: AssemblyConfiguration("")]
11+
[assembly: AssemblyCompany("")]
12+
[assembly: AssemblyProduct("convert-powerpoint-slide-to-image")]
13+
[assembly: AssemblyCopyright("Copyright © 2024")]
14+
[assembly: AssemblyTrademark("")]
15+
[assembly: AssemblyCulture("")]
16+
17+
// Setting ComVisible to false makes the types in this assembly not visible
18+
// to COM components. If you need to access a type in this assembly from
19+
// COM, set the ComVisible attribute to true on that type.
20+
[assembly: ComVisible(false)]
21+
22+
// The following GUID is for the ID of the typelib if this project is exposed to COM
23+
[assembly: Guid("84faa810-55ed-43b0-a597-2f38c8a30aac")]
24+
25+
// Version information for an assembly consists of the following four values:
26+
//
27+
// Major Version
28+
// Minor Version
29+
// Build Number
30+
// Revision
31+
//
32+
[assembly: AssemblyVersion("1.0.0.0")]
33+
[assembly: AssemblyFileVersion("1.0.0.0")]

0 commit comments

Comments
 (0)