diff --git a/Performance-metrices/Clone-and-merge-slides/.NET/Clone-and-merge-slides.sln b/Performance-metrices/Clone-and-merge-slides/.NET/Clone-and-merge-slides.sln new file mode 100644 index 00000000..39a78925 --- /dev/null +++ b/Performance-metrices/Clone-and-merge-slides/.NET/Clone-and-merge-slides.sln @@ -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 diff --git a/Performance-metrices/Clone-and-merge-slides/.NET/Clone-and-merge-slides/Clone-and-merge-slides.csproj b/Performance-metrices/Clone-and-merge-slides/.NET/Clone-and-merge-slides/Clone-and-merge-slides.csproj new file mode 100644 index 00000000..9aa8151f --- /dev/null +++ b/Performance-metrices/Clone-and-merge-slides/.NET/Clone-and-merge-slides/Clone-and-merge-slides.csproj @@ -0,0 +1,15 @@ + + + + Exe + net8.0 + Clone_and_merge_slides + enable + enable + + + + + + + diff --git a/Performance-metrices/Clone-and-merge-slides/.NET/Clone-and-merge-slides/Data/DestinationDocument/PowerPoint-100.pptx b/Performance-metrices/Clone-and-merge-slides/.NET/Clone-and-merge-slides/Data/DestinationDocument/PowerPoint-100.pptx new file mode 100644 index 00000000..645f8f7d Binary files /dev/null and b/Performance-metrices/Clone-and-merge-slides/.NET/Clone-and-merge-slides/Data/DestinationDocument/PowerPoint-100.pptx differ diff --git a/Performance-metrices/Clone-and-merge-slides/.NET/Clone-and-merge-slides/Data/DestinationDocument/PowerPoint-2.pptx b/Performance-metrices/Clone-and-merge-slides/.NET/Clone-and-merge-slides/Data/DestinationDocument/PowerPoint-2.pptx new file mode 100644 index 00000000..87b671e8 Binary files /dev/null and b/Performance-metrices/Clone-and-merge-slides/.NET/Clone-and-merge-slides/Data/DestinationDocument/PowerPoint-2.pptx differ diff --git a/Performance-metrices/Clone-and-merge-slides/.NET/Clone-and-merge-slides/Data/DestinationDocument/PowerPoint-50.pptx b/Performance-metrices/Clone-and-merge-slides/.NET/Clone-and-merge-slides/Data/DestinationDocument/PowerPoint-50.pptx new file mode 100644 index 00000000..b52a0203 Binary files /dev/null and b/Performance-metrices/Clone-and-merge-slides/.NET/Clone-and-merge-slides/Data/DestinationDocument/PowerPoint-50.pptx differ diff --git a/Performance-metrices/Clone-and-merge-slides/.NET/Clone-and-merge-slides/Data/DestinationDocument/PowerPoint-500.pptx b/Performance-metrices/Clone-and-merge-slides/.NET/Clone-and-merge-slides/Data/DestinationDocument/PowerPoint-500.pptx new file mode 100644 index 00000000..d9435c63 Binary files /dev/null and b/Performance-metrices/Clone-and-merge-slides/.NET/Clone-and-merge-slides/Data/DestinationDocument/PowerPoint-500.pptx differ diff --git a/Performance-metrices/Clone-and-merge-slides/.NET/Clone-and-merge-slides/Data/SourceDocument/PowerPoint-100.pptx b/Performance-metrices/Clone-and-merge-slides/.NET/Clone-and-merge-slides/Data/SourceDocument/PowerPoint-100.pptx new file mode 100644 index 00000000..645f8f7d Binary files /dev/null and b/Performance-metrices/Clone-and-merge-slides/.NET/Clone-and-merge-slides/Data/SourceDocument/PowerPoint-100.pptx differ diff --git a/Performance-metrices/Clone-and-merge-slides/.NET/Clone-and-merge-slides/Data/SourceDocument/PowerPoint-2.pptx b/Performance-metrices/Clone-and-merge-slides/.NET/Clone-and-merge-slides/Data/SourceDocument/PowerPoint-2.pptx new file mode 100644 index 00000000..87b671e8 Binary files /dev/null and b/Performance-metrices/Clone-and-merge-slides/.NET/Clone-and-merge-slides/Data/SourceDocument/PowerPoint-2.pptx differ diff --git a/Performance-metrices/Clone-and-merge-slides/.NET/Clone-and-merge-slides/Data/SourceDocument/PowerPoint-50.pptx b/Performance-metrices/Clone-and-merge-slides/.NET/Clone-and-merge-slides/Data/SourceDocument/PowerPoint-50.pptx new file mode 100644 index 00000000..b52a0203 Binary files /dev/null and b/Performance-metrices/Clone-and-merge-slides/.NET/Clone-and-merge-slides/Data/SourceDocument/PowerPoint-50.pptx differ diff --git a/Performance-metrices/Clone-and-merge-slides/.NET/Clone-and-merge-slides/Data/SourceDocument/PowerPoint-500.pptx b/Performance-metrices/Clone-and-merge-slides/.NET/Clone-and-merge-slides/Data/SourceDocument/PowerPoint-500.pptx new file mode 100644 index 00000000..d9435c63 Binary files /dev/null and b/Performance-metrices/Clone-and-merge-slides/.NET/Clone-and-merge-slides/Data/SourceDocument/PowerPoint-500.pptx differ diff --git a/Performance-metrices/Clone-and-merge-slides/.NET/Clone-and-merge-slides/Program.cs b/Performance-metrices/Clone-and-merge-slides/.NET/Clone-and-merge-slides/Program.cs new file mode 100644 index 00000000..ae7e3c80 --- /dev/null +++ b/Performance-metrices/Clone-and-merge-slides/.NET/Clone-and-merge-slides/Program.cs @@ -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}"); + } + } + } +} diff --git a/Performance-metrices/Open-and-save/.NET/Open-and-save-PowerPoint.sln b/Performance-metrices/Open-and-save/.NET/Open-and-save-PowerPoint.sln new file mode 100644 index 00000000..0b71ca61 --- /dev/null +++ b/Performance-metrices/Open-and-save/.NET/Open-and-save-PowerPoint.sln @@ -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 diff --git a/Performance-metrices/Open-and-save/.NET/Open-and-save-PowerPoint/Data/PowerPoint-100.pptx b/Performance-metrices/Open-and-save/.NET/Open-and-save-PowerPoint/Data/PowerPoint-100.pptx new file mode 100644 index 00000000..645f8f7d Binary files /dev/null and b/Performance-metrices/Open-and-save/.NET/Open-and-save-PowerPoint/Data/PowerPoint-100.pptx differ diff --git a/Performance-metrices/Open-and-save/.NET/Open-and-save-PowerPoint/Data/PowerPoint-2.pptx b/Performance-metrices/Open-and-save/.NET/Open-and-save-PowerPoint/Data/PowerPoint-2.pptx new file mode 100644 index 00000000..87b671e8 Binary files /dev/null and b/Performance-metrices/Open-and-save/.NET/Open-and-save-PowerPoint/Data/PowerPoint-2.pptx differ diff --git a/Performance-metrices/Open-and-save/.NET/Open-and-save-PowerPoint/Data/PowerPoint-50.pptx b/Performance-metrices/Open-and-save/.NET/Open-and-save-PowerPoint/Data/PowerPoint-50.pptx new file mode 100644 index 00000000..b52a0203 Binary files /dev/null and b/Performance-metrices/Open-and-save/.NET/Open-and-save-PowerPoint/Data/PowerPoint-50.pptx differ diff --git a/Performance-metrices/Open-and-save/.NET/Open-and-save-PowerPoint/Data/PowerPoint-500.pptx b/Performance-metrices/Open-and-save/.NET/Open-and-save-PowerPoint/Data/PowerPoint-500.pptx new file mode 100644 index 00000000..d9435c63 Binary files /dev/null and b/Performance-metrices/Open-and-save/.NET/Open-and-save-PowerPoint/Data/PowerPoint-500.pptx differ diff --git a/Performance-metrices/Open-and-save/.NET/Open-and-save-PowerPoint/Open-and-save-PowerPoint.csproj b/Performance-metrices/Open-and-save/.NET/Open-and-save-PowerPoint/Open-and-save-PowerPoint.csproj new file mode 100644 index 00000000..26e751cb --- /dev/null +++ b/Performance-metrices/Open-and-save/.NET/Open-and-save-PowerPoint/Open-and-save-PowerPoint.csproj @@ -0,0 +1,15 @@ + + + + Exe + net8.0 + Open_and_save_PowerPoint + enable + enable + + + + + + + diff --git a/Performance-metrices/Open-and-save/.NET/Open-and-save-PowerPoint/Program.cs b/Performance-metrices/Open-and-save/.NET/Open-and-save-PowerPoint/Program.cs new file mode 100644 index 00000000..0ab1bfe9 --- /dev/null +++ b/Performance-metrices/Open-and-save/.NET/Open-and-save-PowerPoint/Program.cs @@ -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}"); + } + } + } +} diff --git a/Performance-metrices/PPTX-to-Image/.NET/Convert-PowerPoint-slide-to-Image.sln b/Performance-metrices/PPTX-to-Image/.NET/Convert-PowerPoint-slide-to-Image.sln new file mode 100644 index 00000000..23a289d8 --- /dev/null +++ b/Performance-metrices/PPTX-to-Image/.NET/Convert-PowerPoint-slide-to-Image.sln @@ -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 diff --git a/Performance-metrices/PPTX-to-Image/.NET/Convert-PowerPoint-slide-to-Image/Convert-PowerPoint-slide-to-Image.csproj b/Performance-metrices/PPTX-to-Image/.NET/Convert-PowerPoint-slide-to-Image/Convert-PowerPoint-slide-to-Image.csproj new file mode 100644 index 00000000..feaf11b3 --- /dev/null +++ b/Performance-metrices/PPTX-to-Image/.NET/Convert-PowerPoint-slide-to-Image/Convert-PowerPoint-slide-to-Image.csproj @@ -0,0 +1,16 @@ + + + + Exe + net8.0 + Convert_PowerPoint_slide_to_Image + enable + enable + + + + + + + + diff --git a/Performance-metrices/PPTX-to-Image/.NET/Convert-PowerPoint-slide-to-Image/Data/PowerPoint-100.pptx b/Performance-metrices/PPTX-to-Image/.NET/Convert-PowerPoint-slide-to-Image/Data/PowerPoint-100.pptx new file mode 100644 index 00000000..645f8f7d Binary files /dev/null and b/Performance-metrices/PPTX-to-Image/.NET/Convert-PowerPoint-slide-to-Image/Data/PowerPoint-100.pptx differ diff --git a/Performance-metrices/PPTX-to-Image/.NET/Convert-PowerPoint-slide-to-Image/Data/PowerPoint-2.pptx b/Performance-metrices/PPTX-to-Image/.NET/Convert-PowerPoint-slide-to-Image/Data/PowerPoint-2.pptx new file mode 100644 index 00000000..87b671e8 Binary files /dev/null and b/Performance-metrices/PPTX-to-Image/.NET/Convert-PowerPoint-slide-to-Image/Data/PowerPoint-2.pptx differ diff --git a/Performance-metrices/PPTX-to-Image/.NET/Convert-PowerPoint-slide-to-Image/Data/PowerPoint-50.pptx b/Performance-metrices/PPTX-to-Image/.NET/Convert-PowerPoint-slide-to-Image/Data/PowerPoint-50.pptx new file mode 100644 index 00000000..b52a0203 Binary files /dev/null and b/Performance-metrices/PPTX-to-Image/.NET/Convert-PowerPoint-slide-to-Image/Data/PowerPoint-50.pptx differ diff --git a/Performance-metrices/PPTX-to-Image/.NET/Convert-PowerPoint-slide-to-Image/Data/PowerPoint-500.pptx b/Performance-metrices/PPTX-to-Image/.NET/Convert-PowerPoint-slide-to-Image/Data/PowerPoint-500.pptx new file mode 100644 index 00000000..d9435c63 Binary files /dev/null and b/Performance-metrices/PPTX-to-Image/.NET/Convert-PowerPoint-slide-to-Image/Data/PowerPoint-500.pptx differ diff --git a/Performance-metrices/PPTX-to-Image/.NET/Convert-PowerPoint-slide-to-Image/Program.cs b/Performance-metrices/PPTX-to-Image/.NET/Convert-PowerPoint-slide-to-Image/Program.cs new file mode 100644 index 00000000..e7bab4bb --- /dev/null +++ b/Performance-metrices/PPTX-to-Image/.NET/Convert-PowerPoint-slide-to-Image/Program.cs @@ -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}"); + } + } + } +} + diff --git a/Performance-metrices/PPTX-to-PDF/.NET/PPTX-to-PDF.sln b/Performance-metrices/PPTX-to-PDF/.NET/PPTX-to-PDF.sln new file mode 100644 index 00000000..444c30e9 --- /dev/null +++ b/Performance-metrices/PPTX-to-PDF/.NET/PPTX-to-PDF.sln @@ -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 diff --git a/Performance-metrices/PPTX-to-PDF/.NET/PPTX-to-PDF/Data/PowerPoint-100.pptx b/Performance-metrices/PPTX-to-PDF/.NET/PPTX-to-PDF/Data/PowerPoint-100.pptx new file mode 100644 index 00000000..645f8f7d Binary files /dev/null and b/Performance-metrices/PPTX-to-PDF/.NET/PPTX-to-PDF/Data/PowerPoint-100.pptx differ diff --git a/Performance-metrices/PPTX-to-PDF/.NET/PPTX-to-PDF/Data/PowerPoint-2.pptx b/Performance-metrices/PPTX-to-PDF/.NET/PPTX-to-PDF/Data/PowerPoint-2.pptx new file mode 100644 index 00000000..87b671e8 Binary files /dev/null and b/Performance-metrices/PPTX-to-PDF/.NET/PPTX-to-PDF/Data/PowerPoint-2.pptx differ diff --git a/Performance-metrices/PPTX-to-PDF/.NET/PPTX-to-PDF/Data/PowerPoint-50.pptx b/Performance-metrices/PPTX-to-PDF/.NET/PPTX-to-PDF/Data/PowerPoint-50.pptx new file mode 100644 index 00000000..b52a0203 Binary files /dev/null and b/Performance-metrices/PPTX-to-PDF/.NET/PPTX-to-PDF/Data/PowerPoint-50.pptx differ diff --git a/Performance-metrices/PPTX-to-PDF/.NET/PPTX-to-PDF/Data/PowerPoint-500.pptx b/Performance-metrices/PPTX-to-PDF/.NET/PPTX-to-PDF/Data/PowerPoint-500.pptx new file mode 100644 index 00000000..d9435c63 Binary files /dev/null and b/Performance-metrices/PPTX-to-PDF/.NET/PPTX-to-PDF/Data/PowerPoint-500.pptx differ diff --git a/Performance-metrices/PPTX-to-PDF/.NET/PPTX-to-PDF/PPTX-to-PDF.csproj b/Performance-metrices/PPTX-to-PDF/.NET/PPTX-to-PDF/PPTX-to-PDF.csproj new file mode 100644 index 00000000..3531fb19 --- /dev/null +++ b/Performance-metrices/PPTX-to-PDF/.NET/PPTX-to-PDF/PPTX-to-PDF.csproj @@ -0,0 +1,15 @@ + + + + Exe + net8.0 + PPTX_to_PDF + enable + enable + + + + + + + diff --git a/Performance-metrices/PPTX-to-PDF/.NET/PPTX-to-PDF/Program.cs b/Performance-metrices/PPTX-to-PDF/.NET/PPTX-to-PDF/Program.cs new file mode 100644 index 00000000..ee3f0119 --- /dev/null +++ b/Performance-metrices/PPTX-to-PDF/.NET/PPTX-to-PDF/Program.cs @@ -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}"); + } + } + } +} +