Skip to content

Commit 5125126

Browse files
author
Sowmiya Loganathan
committed
Update samples and README file
1 parent e99566a commit 5125126

File tree

32 files changed

+700
-2
lines changed

32 files changed

+700
-2
lines changed
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.3.32819.101
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Change-password-of-PDF-document", "Change-password-of-PDF-document\Change-password-of-PDF-document.csproj", "{5BEA913E-BF6E-44F3-9365-484F62DDB5B5}"
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+
{5BEA913E-BF6E-44F3-9365-484F62DDB5B5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15+
{5BEA913E-BF6E-44F3-9365-484F62DDB5B5}.Debug|Any CPU.Build.0 = Debug|Any CPU
16+
{5BEA913E-BF6E-44F3-9365-484F62DDB5B5}.Release|Any CPU.ActiveCfg = Release|Any CPU
17+
{5BEA913E-BF6E-44F3-9365-484F62DDB5B5}.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 = {F53C8777-B1FB-45B2-9CAA-2425163261F3}
24+
EndGlobalSection
25+
EndGlobal
Lines changed: 15 additions & 0 deletions
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>net7.0</TargetFramework>
6+
<RootNamespace>Change_password_of_PDF_document</RootNamespace>
7+
<ImplicitUsings>enable</ImplicitUsings>
8+
<Nullable>enable</Nullable>
9+
</PropertyGroup>
10+
11+
<ItemGroup>
12+
<PackageReference Include="Syncfusion.Pdf.Net.Core" Version="22.1.37" />
13+
</ItemGroup>
14+
15+
</Project>
Binary file not shown.
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
// See https://aka.ms/new-console-template for more information
2+
3+
using Syncfusion.Pdf.Parsing;
4+
using System.Reflection.Metadata;
5+
6+
//Load an existing PDF document.
7+
FileStream docStream = new FileStream("../../../Input.pdf", FileMode.Open, FileAccess.Read);
8+
PdfLoadedDocument loadedDocument = new PdfLoadedDocument(docStream, "ownerPassword256");
9+
//Change the user password.
10+
loadedDocument.Security.UserPassword = "NewUserPassword";
11+
//Change the owner password.
12+
loadedDocument.Security.OwnerPassword = "NewOwnerPassword";
13+
14+
//Create file stream.
15+
using (FileStream outputFileStream = new FileStream(Path.GetFullPath(@"../../../Output.pdf"), FileMode.Create, FileAccess.ReadWrite))
16+
{
17+
//Save the PDF document to file stream.
18+
loadedDocument.Save(outputFileStream);
19+
}
20+
//Close the document.
21+
loadedDocument.Close(true);
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.3.32819.101
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Change-permission-of-PDF-document", "Change-permission-of-PDF-document\Change-permission-of-PDF-document.csproj", "{CF2E4061-7A3E-439E-A511-2EC111424FD1}"
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+
{CF2E4061-7A3E-439E-A511-2EC111424FD1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15+
{CF2E4061-7A3E-439E-A511-2EC111424FD1}.Debug|Any CPU.Build.0 = Debug|Any CPU
16+
{CF2E4061-7A3E-439E-A511-2EC111424FD1}.Release|Any CPU.ActiveCfg = Release|Any CPU
17+
{CF2E4061-7A3E-439E-A511-2EC111424FD1}.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 = {DAAB2B99-CA79-4BAB-9C12-EA133FF36DAA}
24+
EndGlobalSection
25+
EndGlobal
Lines changed: 15 additions & 0 deletions
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>net7.0</TargetFramework>
6+
<RootNamespace>Change_permission_of_PDF_document</RootNamespace>
7+
<ImplicitUsings>enable</ImplicitUsings>
8+
<Nullable>enable</Nullable>
9+
</PropertyGroup>
10+
11+
<ItemGroup>
12+
<PackageReference Include="Syncfusion.Pdf.Net.Core" Version="22.1.38" />
13+
</ItemGroup>
14+
15+
</Project>
Binary file not shown.
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
// See https://aka.ms/new-console-template for more information
2+
3+
using Syncfusion.Pdf.Parsing;
4+
using Syncfusion.Pdf.Security;
5+
6+
//Load the PDF document.
7+
FileStream docStream = new FileStream("../../../Input.pdf", FileMode.Open, FileAccess.Read);
8+
PdfLoadedDocument loadedDocument = new PdfLoadedDocument(docStream, "ownerPassword256");
9+
//Change the permission.
10+
loadedDocument.Security.Permissions = PdfPermissionsFlags.CopyContent | PdfPermissionsFlags.AssembleDocument;
11+
12+
//Save the document into stream
13+
MemoryStream stream = new MemoryStream();
14+
loadedDocument.Save(stream);
15+
//Close the PDF document
16+
loadedDocument.Close(true);
17+
18+
//Create file stream.
19+
using (FileStream outputFileStream = new FileStream(Path.GetFullPath(@"../../../Output.pdf"), FileMode.Create, FileAccess.ReadWrite))
20+
{
21+
//Save the PDF document to file stream.
22+
loadedDocument.Save(outputFileStream);
23+
}
24+
//Close the document.
25+
loadedDocument.Close(true);
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.3.32819.101
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Encrypt-PDF-with-owner-password", "Encrypt-PDF-with-owner-password\Encrypt-PDF-with-owner-password.csproj", "{3C997EF4-4B20-448A-B219-44398D5BBC01}"
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+
{3C997EF4-4B20-448A-B219-44398D5BBC01}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15+
{3C997EF4-4B20-448A-B219-44398D5BBC01}.Debug|Any CPU.Build.0 = Debug|Any CPU
16+
{3C997EF4-4B20-448A-B219-44398D5BBC01}.Release|Any CPU.ActiveCfg = Release|Any CPU
17+
{3C997EF4-4B20-448A-B219-44398D5BBC01}.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 = {DBF19599-4D5E-454A-B769-953E81257824}
24+
EndGlobalSection
25+
EndGlobal
Lines changed: 15 additions & 0 deletions
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>net7.0</TargetFramework>
6+
<RootNamespace>Encrypt_PDF_with_owner_password</RootNamespace>
7+
<ImplicitUsings>enable</ImplicitUsings>
8+
<Nullable>enable</Nullable>
9+
</PropertyGroup>
10+
11+
<ItemGroup>
12+
<PackageReference Include="Syncfusion.Pdf.Net.Core" Version="22.1.37" />
13+
</ItemGroup>
14+
15+
</Project>

0 commit comments

Comments
 (0)