Skip to content

Commit 25d0d64

Browse files
committed
1005727-ug: Added the UG documentation for identify the document permissions
1 parent 9c71b2e commit 25d0d64

File tree

4 files changed

+40
-0
lines changed

4 files changed

+40
-0
lines changed
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<Solution>
2+
<Project Path="PDF-permission-viewer/PDF-permission-viewer.csproj" />
3+
</Solution>
Binary file not shown.
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>net8.0</TargetFramework>
6+
<RootNamespace>PDF_permission_viewer</RootNamespace>
7+
<ImplicitUsings>enable</ImplicitUsings>
8+
<Nullable>enable</Nullable>
9+
</PropertyGroup>
10+
11+
<ItemGroup>
12+
<PackageReference Include="Syncfusion.Pdf.Net.Core" Version="*" />
13+
</ItemGroup>
14+
15+
</Project>
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
using Syncfusion.Pdf.Parsing;
2+
using Syncfusion.Pdf.Security;
3+
4+
// Load an existing PDF
5+
using (PdfLoadedDocument loadedDocument = new PdfLoadedDocument(Path.GetFullPath(@"Data/Input.pdf")))
6+
{
7+
// Access the document security settings
8+
PdfSecurity security = loadedDocument.Security;
9+
// Get the permission flags (bitwise enum)
10+
PdfPermissionsFlags permissions = security.Permissions;
11+
Console.WriteLine("Permissions in the document:");
12+
// Enumerate all flags and print the enabled ones
13+
foreach (PdfPermissionsFlags flag in Enum.GetValues(typeof(PdfPermissionsFlags)))
14+
{
15+
if (flag == 0) continue; // Skip None (0)
16+
// Check whether the specific flag is set
17+
if (permissions.HasFlag(flag))
18+
{
19+
Console.WriteLine($"- {flag}");
20+
}
21+
}
22+
}

0 commit comments

Comments
 (0)