Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save conholdate-com-kb/40412b77c4711722d6dae9da002e8ffb to your computer and use it in GitHub Desktop.
Save conholdate-com-kb/40412b77c4711722d6dae9da002e8ffb to your computer and use it in GitHub Desktop.
How to Remove All Restrictions from PDF in C#. For more details: https://kb.conholdate.com/total/net/how-to-remove-all-restrictions-from-pdf-in-csharp/
using Aspose.Pdf;
using Aspose.Pdf.Facades;
class Program{
static void Main(string[] args) // Remove PDF restrictions in C#
{
// Set PDF license
new License().SetLicense("Aspose.Total.lic");
// Create PdfFileSecurity object
PdfFileSecurity fileSecurity = new PdfFileSecurity();
fileSecurity.BindPdf("PrivilegesApplied.pdf");
// Create DocumentPrivileges object
DocumentPrivilege privilege = DocumentPrivilege.AllowAll;
fileSecurity.SetPrivilege(privilege);
fileSecurity.Save("PrivilegesRemoved.pdf");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment