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

Free Support Forum - aspose.com

Encrypted pdf shows blank on Mac OS using Preview

Any pdfs that we apply encryption to show up blank when opening pdf with the app Preview on the mac operating system. If the pdf has a link then the page is blank with a box where the link is located. Has anyone experienced this issue, we have been able to produce the problem using 2 differant mac machines.


Here is the code we are using to encrypt the pdf:

PdfFileSecurity fileSecurity = new PdfFileSecurity(inputDocument, outputDocument);
// Setup the security object based on options
DocumentPrivilege documentPrivileges = DocumentPrivilege.ForbidAll;
documentPrivileges.AllowCopy = options.AllowCopy;
documentPrivileges.AllowPrint = options.AllowPrint;
documentPrivileges.AllowScreenReaders = true;

fileSecurity.EncryptFile(options.UserPassword, options.OwnerPassword, documentPrivileges, KeySize.x256);

If we don’t encrypt the pdf the file opens without issues, and this is only happening on a Mac when using Preview. All other OS and pdf readers opens the file without any issues.

Thanks.

Hi,


We are working over this query and will get back to you soon. We apologize for the delay and inconvenience.

Hello
Steve,


Thanks for your patience and sorry for replying you so late.

I have tested the scenario where I have encrypted the PDF document using Aspose.Pdf for .NET 6.5.0 and when I have tried viewing it in PDF Viewer over MAC OS, and as per my observations, it did not prompt for the password and the PDF is being displayed as blank. For the sake of correction, I have logged this problem as PDFNEWNET-32829 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. We are really sorry for this inconvenience.

Hello Steve,


Thanks for your patience.

We have further investigated this problem and have found that the issue seems to be related to Preview software. This is the default pdf viewer on MacOS but it has some drawbacks when opening password protected documents. Your document has password (not empty) and in order to view this document, this password should be provided. However the Preview application simply opens this document without any prompt for password and that is why it can not represent its contents. Moreover we have made small investigation where we created a password protected document (AES, 128bit) and tried to open it in Preview. On opening Preview said “the document is damaged”. I am not sure but there might be some option/control where the password information cab be provided so that password protected documents can be viewed properly.

Can you please download and install Adobe Reader, because as per our observations, we were successfully
able to open the document that you have already shared. We tested it on MacOS 10.6.4. So, currently it does not seem to be an issue related to Aspose.Pdf for .NET.

We are really sorry for your inconvenience.