Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.4.33110.190
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Clone-and-merge-slides", "Clone-and-merge-slides\Clone-and-merge-slides.csproj", "{200E55BD-87C8-4D42-A14E-290C0AB1EF00}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{200E55BD-87C8-4D42-A14E-290C0AB1EF00}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{200E55BD-87C8-4D42-A14E-290C0AB1EF00}.Debug|Any CPU.Build.0 = Debug|Any CPU
{200E55BD-87C8-4D42-A14E-290C0AB1EF00}.Release|Any CPU.ActiveCfg = Release|Any CPU
{200E55BD-87C8-4D42-A14E-290C0AB1EF00}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {5944F990-AC83-4E81-AEB9-28E7F2EE876D}
EndGlobalSection
EndGlobal
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<RootNamespace>Clone_and_merge_slides</RootNamespace>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Syncfusion.Presentation.NET" Version="*" />
</ItemGroup>

</Project>
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
using System.Diagnostics;
using Syncfusion.Presentation;

class Program
{
static void Main()
{
string sourceFolder = Path.GetFullPath("../../../Data/SourceDocument/");
string destinationFolder = Path.GetFullPath("../../../Data/DestinationDocument/");
string outputFolder = Path.GetFullPath("../../../Output/");

Directory.CreateDirectory(outputFolder);

// Get all source files
string[] sourceFiles = Directory.GetFiles(sourceFolder, "*.pptx");

foreach (string sourcePath in sourceFiles)
{
string fileName = Path.GetFileName(sourcePath);
string destinationPath = Path.Combine(destinationFolder, fileName);

if (!File.Exists(destinationPath))
{
Console.WriteLine($"Skipping {fileName} - No matching destination file found.");
continue;
}

string outputPath = Path.Combine(outputFolder, fileName);

Stopwatch stopwatch = Stopwatch.StartNew();

try
{
// Open source and destination presentations
using FileStream sourceStream = new(sourcePath, FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
using IPresentation sourcePresentation = Presentation.Open(sourceStream);

using FileStream destinationStream = new(destinationPath, FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
using IPresentation destinationPresentation = Presentation.Open(destinationStream);

// Clone and merge all slides
foreach (ISlide slide in sourcePresentation.Slides)
{
ISlide clonedSlide = slide.Clone();
destinationPresentation.Slides.Add(clonedSlide, PasteOptions.UseDestinationTheme);
}

// Save the merged presentation
using FileStream outputStream = new(outputPath, FileMode.Create, FileAccess.ReadWrite);
destinationPresentation.Save(outputStream);

stopwatch.Stop();
Console.WriteLine($"{fileName} is cloned and merged in {stopwatch.Elapsed.TotalSeconds} seconds.");
}
catch (Exception ex)
{
Console.WriteLine($"Error processing {fileName}: {ex.Message}");
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.4.33110.190
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Open-and-save-PowerPoint", "Open-and-save-PowerPoint\Open-and-save-PowerPoint.csproj", "{200E55BD-87C8-4D42-A14E-290C0AB1EF00}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{200E55BD-87C8-4D42-A14E-290C0AB1EF00}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{200E55BD-87C8-4D42-A14E-290C0AB1EF00}.Debug|Any CPU.Build.0 = Debug|Any CPU
{200E55BD-87C8-4D42-A14E-290C0AB1EF00}.Release|Any CPU.ActiveCfg = Release|Any CPU
{200E55BD-87C8-4D42-A14E-290C0AB1EF00}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {5944F990-AC83-4E81-AEB9-28E7F2EE876D}
EndGlobalSection
EndGlobal
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<RootNamespace>Open_and_save_PowerPoint</RootNamespace>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Syncfusion.Presentation.NET" Version="*" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
using System.Diagnostics;
using Syncfusion.Presentation;

class Program
{
static void Main()
{
string inputFolder = Path.GetFullPath("../../../Data/");
string outputFolder = Path.GetFullPath("../../../Output/");

Directory.CreateDirectory(outputFolder);

// Get all .pptx files in the Data folder
string[] files = Directory.GetFiles(inputFolder, "*.pptx");

foreach (string inputPath in files)
{
string fileName = Path.GetFileName(inputPath);
string outputPath = Path.Combine(outputFolder, fileName);

Stopwatch stopwatch = Stopwatch.StartNew();

try
{
// Load or open PowerPoint Presentation
using FileStream inputStream = new(inputPath, FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
using IPresentation pptxDoc = Presentation.Open(inputStream);

// Save the presentation to Output folder
using FileStream outputStream = new(outputPath, FileMode.Create, FileAccess.ReadWrite);
pptxDoc.Save(outputStream);

stopwatch.Stop();
Console.WriteLine($"{fileName} open and saved in {stopwatch.Elapsed.TotalSeconds} seconds");
}
catch (Exception ex)
{
Console.WriteLine($"Error processing {fileName}: {ex.Message}");
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.4.33110.190
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Convert-PowerPoint-slide-to-Image", "Convert-PowerPoint-slide-to-Image\Convert-PowerPoint-slide-to-Image.csproj", "{200E55BD-87C8-4D42-A14E-290C0AB1EF00}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{200E55BD-87C8-4D42-A14E-290C0AB1EF00}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{200E55BD-87C8-4D42-A14E-290C0AB1EF00}.Debug|Any CPU.Build.0 = Debug|Any CPU
{200E55BD-87C8-4D42-A14E-290C0AB1EF00}.Release|Any CPU.ActiveCfg = Release|Any CPU
{200E55BD-87C8-4D42-A14E-290C0AB1EF00}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {5944F990-AC83-4E81-AEB9-28E7F2EE876D}
EndGlobalSection
EndGlobal
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<RootNamespace>Convert_PowerPoint_slide_to_Image</RootNamespace>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Syncfusion.Presentation.NET" Version="*" />
<PackageReference Include="Syncfusion.PresentationRenderer.NET" Version="*" />
</ItemGroup>

</Project>
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
using System.Diagnostics;
using Syncfusion.Presentation;
using Syncfusion.PresentationRenderer;

class Program
{
static void Main()
{
string inputFolder = Path.GetFullPath("../../../Data/");
string outputFolder = Path.GetFullPath("../../../Output/");

Directory.CreateDirectory(outputFolder);

// Get all .pptx files in the Data folder
string[] files = Directory.GetFiles(inputFolder, "*.pptx");

foreach (string inputPath in files)
{
string fileName = Path.GetFileName(inputPath);
string slideOutputFolder = Path.Combine(outputFolder, Path.GetFileNameWithoutExtension(fileName));
Directory.CreateDirectory(slideOutputFolder);

Stopwatch stopwatch = Stopwatch.StartNew();

try
{
// Open presentation
using (FileStream inputStream = new(inputPath, FileMode.Open, FileAccess.Read, FileShare.ReadWrite))
{
using (IPresentation pptxDoc = Presentation.Open(inputStream))
{
pptxDoc.PresentationRenderer = new PresentationRenderer();

// Convert each slide to an image
for (int i = 0; i < pptxDoc.Slides.Count; i++)
{
using (Stream stream = pptxDoc.Slides[i].ConvertToImage(ExportImageFormat.Jpeg))
{
string imagePath = Path.Combine(slideOutputFolder, $"Slide_{i + 1}.jpg");
using (FileStream fileStreamOutput = new(imagePath, FileMode.Create, FileAccess.Write))
{
stream.CopyTo(fileStreamOutput);
}
}
}
}
}
stopwatch.Stop();
Console.WriteLine($"{fileName} processed in {stopwatch.Elapsed.TotalSeconds} seconds");
}
catch (Exception ex)
{
Console.WriteLine($"Error processing {fileName}: {ex.Message}");
}
}
}
}

25 changes: 25 additions & 0 deletions Performance-metrices/PPTX-to-PDF/.NET/PPTX-to-PDF.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.4.33110.190
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PPTX-to-PDF", "PPTX-to-PDF\PPTX-to-PDF.csproj", "{200E55BD-87C8-4D42-A14E-290C0AB1EF00}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{200E55BD-87C8-4D42-A14E-290C0AB1EF00}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{200E55BD-87C8-4D42-A14E-290C0AB1EF00}.Debug|Any CPU.Build.0 = Debug|Any CPU
{200E55BD-87C8-4D42-A14E-290C0AB1EF00}.Release|Any CPU.ActiveCfg = Release|Any CPU
{200E55BD-87C8-4D42-A14E-290C0AB1EF00}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {5944F990-AC83-4E81-AEB9-28E7F2EE876D}
EndGlobalSection
EndGlobal
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<RootNamespace>PPTX_to_PDF</RootNamespace>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Syncfusion.Presentation.NET" Version="*" />
<PackageReference Include="Syncfusion.PresentationRenderer.NET" Version="*" />
</ItemGroup>
</Project>
54 changes: 54 additions & 0 deletions Performance-metrices/PPTX-to-PDF/.NET/PPTX-to-PDF/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
using System.Diagnostics;
using Syncfusion.Presentation;
using Syncfusion.PresentationRenderer;
using Syncfusion.Pdf;

class Program
{
static void Main()
{
string inputFolder = Path.GetFullPath("../../../Data/");
string outputFolder = Path.GetFullPath("../../../Output/");

Directory.CreateDirectory(outputFolder);

// Get all .pptx files in the Data folder
string[] files = Directory.GetFiles(inputFolder, "*.pptx");

foreach (string inputPath in files)
{
string fileName = Path.GetFileName(inputPath);
string outputPath = Path.Combine(outputFolder, Path.GetFileNameWithoutExtension(fileName) + ".pdf");

Stopwatch stopwatch = Stopwatch.StartNew();

try
{
// Open and convert presentation to PDF
using (FileStream inputStream = new(inputPath, FileMode.Open, FileAccess.Read, FileShare.ReadWrite))
{
using (IPresentation pptxDoc = Presentation.Open(inputStream))
{
pptxDoc.PresentationRenderer = new PresentationRenderer();

// Convert PowerPoint to PDF
using (PdfDocument pdfDocument = PresentationToPdfConverter.Convert(pptxDoc))
{
using (FileStream outputStream = new(outputPath, FileMode.Create, FileAccess.Write))
{
pdfDocument.Save(outputStream);
}
}
}
}
stopwatch.Stop();
Console.WriteLine($"{fileName} taken time to convert as PDF: {stopwatch.Elapsed.TotalSeconds} seconds");
}
catch (Exception ex)
{
Console.WriteLine($"Error processing {fileName}: {ex.Message}");
}
}
}
}