We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

PDF Permission - Changing the document - Not Allowed

Hi -
I have batch of PDFs and need to change the permissions of Changing the document to be Allowed from Not Allowed (see screen shot).
I tried using the below code but not working…

        pdf = new Aspose.Pdf.Document(fileName);
        Aspose.Pdf.Facades.DocumentPrivilege privilege = Aspose.Pdf.Facades.DocumentPrivilege.AllowAll;
        privilege.AllowPrint = true;
        privilege.AllowCopy = true;
        privilege.AllowAssembly = true;
        privilege.AllowModifyContents = false;
        privilege.AllowDegradedPrinting = true;
        privilege.AllowFillIn = true;
        privilege.AllowModifyAnnotations = true; 
        privilege.AllowPrint = true;
        privilege.AllowScreenReaders = true;
        privilege.ChangeAllowLevel = 4;
        Aspose.Pdf.Facades.PdfFileSecurity fs = new Aspose.Pdf.Facades.PdfFileSecurity();
        fs.BindPdf(pdf);
        fs.SetPrivilege(privilege);
        pdf.Decrypt();
        pdf.Save(filePath + "\\RemovedSecurity" + timestamp + ".pdf");

@ppatel5

Thanks for your inquiry.

We could not find any attachment with the post. Furthermore, could you please share a sample PDF document with us. We will test the scenario in our environment and address it accordingly.

FDA-2253.pdf (1.7 MB)
Capture.PNG (11.3 KB)
Attaching the properties screen shot as well as the pdf file.

@ppatel5

Thanks for sharing sample PDF document.

We have tested the scenario in our environment using Aspose.PDF for .NET 19.3 and your code snippet. We were able to reproduce the issue that you have mentioned. It seems that your PDF has restrictions set due to its form fields and API is unable to remove that restriction.

Therefore, we have logged an issue as PDFNET-46120 in our issue tracking system for the sake of correction. We will further look into details of the issue and keep you posted with the status of its rectification. Please be patient and spare us little time.

We are sorry for the inconvenience.