You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: Document-Processing/PDF/PDF-Library/NET/Working-with-Security.md
+77Lines changed: 77 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1603,6 +1603,83 @@ loadedDocument.Close(True)
1603
1603
1604
1604
You can download a complete working sample from [GitHub](https://github.com/SyncfusionExamples/PDF-Examples/tree/master/Security/Change-the-permission-of-the-PDF-document/).
1605
1605
1606
+
## View document permission flags
1607
+
1608
+
Read a PDF document permission flags via the [Security.Permissions](https://help.syncfusion.com/cr/document-processing/Syncfusion.Pdf.Security.PdfSecurity.html#Syncfusion_Pdf_Security_PdfSecurity_Permissions) property, which returns a bitwise combination of values from the [PdfPermissionsFlags](https://help.syncfusion.com/cr/document-processing/Syncfusion.Pdf.Security.PdfPermissionsFlags.html) enumeration.
1609
+
1610
+
{% tabs %}
1611
+
{% highlight c# tabtitle="C# [Cross-platform]" %}
1612
+
1613
+
// Load an existing PDF
1614
+
using (PdfLoadedDocument loadedDocument = new PdfLoadedDocument("Input.pdf"))
Using loadedDocument As New PdfLoadedDocument("Input.pdf")
1661
+
' Access the document security settings
1662
+
Dim security As PdfSecurity = loadedDocument.Security
1663
+
' Get the permission flags (bitwise enum)
1664
+
Dim permissions As PdfPermissionsFlags = security.Permissions
1665
+
Console.WriteLine("Permissions in the document:")
1666
+
' Enumerate all flags and print the enabled ones
1667
+
For Each flag As PdfPermissionsFlags In [Enum].GetValues(GetType(PdfPermissionsFlags))
1668
+
If flag = 0 Then
1669
+
Continue For ' Skip None (0)
1670
+
End If
1671
+
' Check whether the specific flag is set
1672
+
If permissions.HasFlag(flag) Then
1673
+
Console.WriteLine($"- {flag}")
1674
+
End If
1675
+
Next
1676
+
End Using
1677
+
1678
+
{% endhighlight %}
1679
+
{% endtabs %}
1680
+
1681
+
You can download a complete working sample from GitHub.
1682
+
1606
1683
## Remove password from the user password PDF document
1607
1684
1608
1685
You can remove the [UserPassword](https://help.syncfusion.com/cr/document-processing/Syncfusion.Pdf.Security.PdfSecurity.html#Syncfusion_Pdf_Security_PdfSecurity_UserPassword) from the encrypted PDF document by using the following code snippet.
0 commit comments