PDFFileSecurity/DocumentPrivilege does not work to set AllowDegradedPrinting

Using Aspose.PDF 9.6.0.0, our code is having issues setting the Degraded Printing property for the PDFFileSecurity. Looking for guidance on the best way to do this. Sample code below:


var docPrivilege = Aspose.Pdf.Facades.DocumentPrivilege.ForbidAll;
docPrivilege.AllowDegradedPrinting = true;

var fileSecurity = new Aspose.Pdf.Facades.PdfFileSecurity();
fileSecurity.BindPdf(@"C:\temp\test.pdf");
fileSecurity.EncryptFile("test","test",docPrivilege,Aspose.Pdf.Facades.KeySize.x128,Aspose.Pdf.Facades.Algorithm.AES);
fileSecurity.Save(@"C:\temp\tbdSec.pdf");

Hi,


Thanks for contacting support.

I have tested the scenario using Aspose.Pdf for .NET 9.6.0 where I have used one of my sample PDF files and as per my observations, the Printing privilege is being set on resultant PDF file. Can you please share some sample PDF document which an help us in replicating this issue at our end. We are sorry for your inconvenience.

I’ve attached two files: the TBD.pdf is the starting file. The tbd.pdfcleaned.pdf is the result of running through the code below. When I open the resulting file in Adobe Acrobat 11, I do not see the Degraded Printing or other printing options set.


private void setSecurity(string path)
{
var docPrivilege = Aspose.Pdf.Facades.DocumentPrivilege.ForbidAll;
docPrivilege.AllowDegradedPrinting = true;

var fileSecurity = new Aspose.Pdf.Facades.PdfFileSecurity();
fileSecurity.BindPdf(path);
fileSecurity.EncryptFile(“test”, “test2”, docPrivilege, Aspose.Pdf.Facades.KeySize.x128, Aspose.Pdf.Facades.Algorithm.AES);
fileSecurity.Save(path + “cleaned.pdf”);
}

Hi,


Thanks for sharing the resource file.

I have tested the scenario using Aspose.Pdf for .NET 9.6.0 and as per my observations, when viewing the resultant file in Adobe Reader 11.0.3 and Adobe Acrobat 11.0 using password test (user password), the print button is disabled. However when using the password test2 (which is owner password), the print button is appearing as enabled.

Once access privileges are specified, only owner/admin can update document or have full access permissions.

Lost track of this issue. I went back and re-tested with Aspose.PDF 9.8. If I start with ForbidAll as a privilege and then attempt to allow DegradedPrinting, it will not show the change in Acrobat Reader. However if I start with AllowAll and then disable DegradedPrinting, the code works successfully.


This is different behavior then the 8.x version series.

Hi,


I have tested the scenario and I am able to
notice the same problem. For the sake of correction, I have logged this problem
as PDFNEWNET-37846 in our issue tracking system. We will further
look into the details of this problem and will keep you updated on the status
of correction. Please be patient and spare us little time. We are sorry for
this inconvenience.

Just checking to see if there is any status for a fix around this issue.


Thank you

Hi

Thanks for your patience.

The development team has been busy resolving other priority issues and I am afraid the aforementioned problem is not yet resolved. Nevertheless, I have requested the development team to try accommodating the investigation of this issue in their development schedule and as soon as I have some updates regarding its resolution, I would be more than happy to update you with the status of correction. Please be patient and spare us some time.

We are sorry for this delay and inconvenience.

Hi there,

Thanks for your patience. We have further investigated and found that if allow-printing hasn’t been specified, printing is restricted to the print as image feature which prints a low-resolution rendition of the page. So you should also enable the allow-print option as following. It will help you to accomplish the task.

var docPrivilege = DocumentPrivilege.ForbidAll;
docPrivilege.AllowPrint = true;
docPrivilege.AllowDegradedPrinting = true;

var fileSecurity = new Aspose.Pdf.Facades.PdfFileSecurity();
fileSecurity.BindPdf(myDir + "tbd.pdf");
fileSecurity.EncryptFile("test", "test2", docPrivilege, KeySize.x128, Algorithm.AES);
fileSecurity.Save(myDir + "tbd_AllowAll.pdf");

Please feel free to contact us for any further assistance.

Best Regards,

Just tested this code with the steps and I get the same result as before. Adobe Reader indicates I have High Resolution printing enabled when I look at the Properties, Security. I have tested with 10.5.0.0.

Hi there,


We are sorry for the inconvenience. Our product team is looking again the issue with priority and will update you soon.

Best Regards,

Hi,


Thanks for your patience.

In order to generate correct output, please try setting docPrivilege.AllowDegradedPrinting
=
false; in earlier shared code snippet.

Should you have any further query, please feel free to contact.

Yes–changing the code to set the Printing to “true” and DegradedPrinting to “false” works with 10.5.0

Hi there,


Thanks for your feedback. It is good to know that you have managed to resolve the issue.

Please keep using our API and feel free to ask any query or concern, we will be more than happy to extend our support.

Best Regards,