Skip to content

Commit 5abbda7

Browse files
Added README file
1 parent 466b71a commit 5abbda7

File tree

13 files changed

+142
-38
lines changed

13 files changed

+142
-38
lines changed

PPTX-to-Image-conversion/Convert-PowerPoint-slide-to-Image/.NET/Convert-PowerPoint-slide-to-Image/Program.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@
99
pptxDoc.PresentationRenderer = new PresentationRenderer();
1010
//Convert PowerPoint slide to image as stream.
1111
using Stream stream = pptxDoc.Slides[0].ConvertToImage(ExportImageFormat.Jpeg);
12-
//Reset the stream position.
13-
stream.Position = 0;
1412
//Create the output image file stream.
1513
using FileStream fileStreamOutput = File.Create(Path.GetFullPath(@"Output/Output.jpg"));
1614
//Copy the converted image stream into created output stream.

PPTX-to-Image-conversion/Convert-PowerPoint-slide-to-Image/.NET/Convert-PowerPoint-slide-to-Image/README.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,6 @@ using IPresentation pptxDoc = Presentation.Open(inputStream);
2727
pptxDoc.PresentationRenderer = new PresentationRenderer();
2828
//Convert PowerPoint slide to image as stream.
2929
using Stream stream = pptxDoc.Slides[0].ConvertToImage(ExportImageFormat.Jpeg);
30-
//Reset the stream position.
31-
stream.Position = 0;
3230
//Create the output image file stream.
3331
using FileStream fileStreamOutput = File.Create(Path.GetFullPath(@"Output/Output.jpg"));
3432
//Copy the converted image stream into created output stream.

PPTX-to-PDF-conversion/Convert-PowerPoint-into-accessible-PDF/.NET/Convert-PowerPoint-into-accessible-PDF/Program.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
pdfConverterSettings.AutoTag = true;
1313
//Convert the PowerPoint document to a PDF document.
1414
using PdfDocument pdfDocument = PresentationToPdfConverter.Convert(pptxDoc, pdfConverterSettings);
15-
//Save the converted PDF document to the fileStream.
16-
using FileStream fileStreamOutput = File.Create(Path.GetFullPath("Output/PPTXToPDF.pdf"));
17-
pdfDocument.Save(fileStreamOutput);
18-
fileStreamOutput.Position = 0;
15+
//Create new instance of file stream.
16+
using FileStream fileStreamOutput = new(Path.GetFullPath(@"Output/PPTXToPDF.pdf"), FileMode.Create);
17+
//Save the generated PDF to file stream.
18+
pdfDocument.Save(fileStreamOutput);

PPTX-to-PDF-conversion/Convert-PowerPoint-into-accessible-PDF/.NET/Convert-PowerPoint-into-accessible-PDF/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,10 @@ PresentationToPdfConverterSettings pdfConverterSettings = new PresentationToPdfC
3030
pdfConverterSettings.AutoTag = true;
3131
//Convert the PowerPoint document to a PDF document.
3232
using PdfDocument pdfDocument = PresentationToPdfConverter.Convert(pptxDoc, pdfConverterSettings);
33-
//Save the converted PDF document to the fileStream.
34-
using FileStream fileStreamOutput = File.Create(Path.GetFullPath("Output/PPTXToPDF.pdf"));
33+
//Create new instance of file stream.
34+
using FileStream fileStreamOutput = new(Path.GetFullPath(@"Output/PPTXToPDF.pdf"), FileMode.Create);
35+
//Save the generated PDF to file stream.
3536
pdfDocument.Save(fileStreamOutput);
36-
fileStreamOutput.Position = 0;
3737
```
3838

3939
More information about PPTX to PDF/UA conversion can be found in this [documentation](https://help.syncfusion.com/document-processing/powerpoint/conversions/powerpoint-to-pdf/net/presentation-to-pdf#accessible-pdf-document) section.

PPTX-to-PDF-conversion/Convert-PowerPoint-presentation-to-PDF/.NET/Convert-PowerPoint-presentation-to-PDF/README.md

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -20,21 +20,23 @@ using System.IO;
2020
Step 4: Add the following code snippet in Program.cs file to convert a PowerPoint Presentation to PDF.
2121

2222
```csharp
23-
//Load or open an PowerPoint Presentation.
24-
using FileStream inputStream = new(Path.GetFullPath(@"Data/Template.pptx"), FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
25-
//Open an existing PowerPoint presentation.
26-
using IPresentation pptxDoc = Presentation.Open(inputStream);
27-
//Create the MemoryStream to save the converted PDF.
28-
using MemoryStream pdfStream = new();
29-
//Convert the PowerPoint document to PDF document.
30-
using PdfDocument pdfDocument = PresentationToPdfConverter.Convert(pptxDoc);
31-
//Save the converted PDF document to MemoryStream.
32-
pdfDocument.Save(pdfStream);
33-
pdfStream.Position = 0;
34-
//Create the output PDF file stream.
35-
using FileStream fileStreamOutput = File.Create(Path.GetFullPath(@"Output/PPTXToPDF.pdf"));
36-
//Copy the converted PDF stream into created output PDF stream.
37-
pdfStream.CopyTo(fileStreamOutput);
23+
//Open the PowerPoint file stream.
24+
using (FileStream fileStream = new FileStream(Path.GetFullPath(@"Data/Template.pptx"), FileMode.Open, FileAccess.Read, FileShare.ReadWrite))
25+
{
26+
//Load an existing PowerPoint Presentation.
27+
using (IPresentation pptxDoc = Presentation.Open(fileStream))
28+
{
29+
//Convert PowerPoint into PDF document.
30+
using (PdfDocument pdfDocument = PresentationToPdfConverter.Convert(pptxDoc))
31+
{
32+
//Save the PDF file to file system.
33+
using (FileStream outputStream = new FileStream(Path.GetFullPath(@"Output/PPTXToPDF.pdf"), FileMode.Create, FileAccess.ReadWrite, FileShare.ReadWrite))
34+
{
35+
pdfDocument.Save(outputStream);
36+
}
37+
}
38+
}
39+
}
3840
```
3941

4042
More information about PPTX to PDF conversion can be found in this [documentation](https://help.syncfusion.com/document-processing/powerpoint/conversions/powerpoint-to-pdf/net/presentation-to-pdf) section.
Lines changed: 25 additions & 0 deletions
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.11.35327.3
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Merge-two-presentations", "Merge-two-presentations\Merge-two-presentations.csproj", "{C6039BBA-48D0-4E1F-BD63-466AE4C60704}"
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+
{C6039BBA-48D0-4E1F-BD63-466AE4C60704}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15+
{C6039BBA-48D0-4E1F-BD63-466AE4C60704}.Debug|Any CPU.Build.0 = Debug|Any CPU
16+
{C6039BBA-48D0-4E1F-BD63-466AE4C60704}.Release|Any CPU.ActiveCfg = Release|Any CPU
17+
{C6039BBA-48D0-4E1F-BD63-466AE4C60704}.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 = {088F677A-7D77-4D4D-901D-FC77679F7DC7}
24+
EndGlobalSection
25+
EndGlobal
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<OutputType>Exe</OutputType>
5+
<TargetFramework>net8.0</TargetFramework>
6+
<RootNamespace>Merge_two_presentations</RootNamespace>
7+
<ImplicitUsings>enable</ImplicitUsings>
8+
<Nullable>enable</Nullable>
9+
</PropertyGroup>
10+
11+
<ItemGroup>
12+
<PackageReference Include="Syncfusion.Presentation.NET" Version="*" />
13+
</ItemGroup>
14+
15+
<ItemGroup>
16+
<None Update="Data\SourcePresentation.pptx">
17+
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
18+
</None>
19+
<None Update="Data\DestinationPresentation.pptx">
20+
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
21+
</None>
22+
<None Update="Output\.gitkeep">
23+
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
24+
</None>
25+
</ItemGroup>
26+
27+
</Project>

PowerPoint-Presentation/Merge-two-presentations/.NET/Merge-two-presentations/Output/.gitkeep

Whitespace-only changes.
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
using Syncfusion.Presentation;
2+
3+
//Open an existing source presentation.
4+
using FileStream sourceStream = new FileStream(Path.GetFullPath(@"Data/SourcePresentation.pptx"), FileMode.Open);
5+
using IPresentation sourcePresentation = Presentation.Open(sourceStream);
6+
//Open an existing destination presentation.
7+
using FileStream destinationStream = new FileStream(Path.GetFullPath(@"Data/DestinationPresentation.pptx"), FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
8+
using IPresentation destinationPresentation = Presentation.Open(destinationStream);
9+
//Iterate each slide in source and merge to presentation.
10+
for (int i = 0; i < sourcePresentation.Slides.Count; i++)
11+
{
12+
//Clone the slide of the source presentation.
13+
ISlide clonedSlide = sourcePresentation.Slides[i].Clone();
14+
//Merge the cloned slide into the destination presentation.
15+
destinationPresentation.Slides.Add(clonedSlide, PasteOptions.UseDestinationTheme, sourcePresentation);
16+
}
17+
//Save the PowerPoint presentation.
18+
using FileStream outputStream = new FileStream(Path.GetFullPath(@"Output/Result.pptx"), FileMode.Create);
19+
destinationPresentation.Save(outputStream);

Slides/Merge-PowerPoint-slide/.NET/Merge-PowerPoint-slide/README.md renamed to PowerPoint-Presentation/Merge-two-presentations/.NET/Merge-two-presentations/README.md

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -18,18 +18,22 @@ using System.IO;
1818
Step 4: Add the following code snippet in Program.cs file to merge PowerPoint Presentations.
1919

2020
```csharp
21-
//Load or open an PowerPoint Presentation.
22-
using FileStream sourcePresentationStream = new(Path.GetFullPath(@"Data/SourcePresentation.pptx"), FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
23-
using FileStream destinationPresentationStream = new(Path.GetFullPath(@"Data/DestinationPresentation.pptx"), FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
24-
//Open an existing PowerPoint presentation.
25-
using IPresentation sourcePresentation = Presentation.Open(sourcePresentationStream);
26-
//Open the destination Presentation.
27-
using IPresentation destinationPresentation = Presentation.Open(destinationPresentationStream);
28-
//Clone the first slide of the source Presentation.
29-
ISlide clonedSlide = sourcePresentation.Slides[0].Clone();
30-
//Merge the cloned slide to the destination Presentation with paste option - Destination Theme.
31-
destinationPresentation.Slides.Add(clonedSlide, PasteOptions.UseDestinationTheme);
32-
using FileStream outputStream = new(Path.GetFullPath(@"Output/Result.pptx"), FileMode.Create, FileAccess.ReadWrite);
21+
//Open an existing source presentation.
22+
using FileStream sourceStream = new FileStream(Path.GetFullPath(@"Data/SourcePresentation.pptx"), FileMode.Open);
23+
using IPresentation sourcePresentation = Presentation.Open(sourceStream);
24+
//Open an existing destination presentation.
25+
using FileStream destinationStream = new FileStream(Path.GetFullPath(@"Data/DestinationPresentation.pptx"), FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
26+
using IPresentation destinationPresentation = Presentation.Open(destinationStream);
27+
//Iterate each slide in source and merge to presentation.
28+
for (int i = 0; i < sourcePresentation.Slides.Count; i++)
29+
{
30+
//Clone the slide of the source presentation.
31+
ISlide clonedSlide = sourcePresentation.Slides[i].Clone();
32+
//Merge the cloned slide into the destination presentation.
33+
destinationPresentation.Slides.Add(clonedSlide, PasteOptions.UseDestinationTheme, sourcePresentation);
34+
}
35+
//Save the PowerPoint presentation.
36+
using FileStream outputStream = new FileStream(Path.GetFullPath(@"Output/Result.pptx"), FileMode.Create);
3337
destinationPresentation.Save(outputStream);
3438
```
3539

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# Decrypt PowerPoint Presentation using C#
2+
3+
The Syncfusion [.NET PowerPoint Library](https://www.syncfusion.com/document-processing/powerpoint-framework/net/powerpoint-library) (Presentation) enables you to create, read, and edit PowerPoint files programmatically without Microsoft office or interop dependencies. Using this library, you can **decrypt a PowerPoint Presentation** using C#.
4+
5+
## Steps to decrypt a PowerPoint Presentation programmatically
6+
7+
Step 1: Create a new .NET Core console application project.
8+
9+
Step 2: Install the [Syncfusion.Presentation.Net.Core](https://www.nuget.org/packages/Syncfusion.Presentation.Net.Core) NuGet package as a reference to your project from [NuGet.org](https://www.nuget.org/).
10+
11+
Step 3: Include the following namespaces in the Program.cs file.
12+
13+
```csharp
14+
using Syncfusion.Presentation;
15+
using System.IO;
16+
```
17+
18+
Step 4: Add the following code snippet in Program.cs file to decrypt the PowerPoint Presentation.
19+
20+
```csharp
21+
//Load or open an PowerPoint Presentation.
22+
using FileStream inputStream = new(Path.GetFullPath(@"Data/Template.pptx"), FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
23+
//Open an existing Presentation from file system and it can be decrypted by using the provided password.
24+
using IPresentation presentation = Presentation.Open(inputStream, "syncfusion");
25+
//Decrypt the presentation.
26+
presentation.RemoveEncryption();
27+
using FileStream outputStream = new(Path.GetFullPath(@"Output/Result.pptx"), FileMode.Create, FileAccess.ReadWrite);
28+
presentation.Save(outputStream);
29+
```
30+
31+
More information about decrypting presentations can be found in this [documentation](https://help.syncfusion.com/document-processing/powerpoint/powerpoint-library/net/security) section.

0 commit comments

Comments
 (0)