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

Free Support Forum - aspose.com

PDF password protection not working

I have the Aspose Total lic. (pdf.dll v9.1.0.0)

I an using the PDF password protect API but when I open the PDF file
the OWNER and USER see the same menu options
- what i mean is that the OWN also see the menu options disabled.

here’s the code I am using…

Aspose.Pdf.Permissions _Permissions = new Aspose.Pdf.Permissions(); // nothing enabled
Aspose.Pdf.CryptoAlgorithm _CryptoAlgorithm = Aspose.Pdf.CryptoAlgorithm.AESx128;

doc.Encrypt(UserPassword,
OwnerPassword,
_Permissions,
_CryptoAlgorithm);




Hi Nitin,


Thanks for contacting support.

I have tested the scenario using Aspose.Pdf for .NET 9.1.0 where I have used one of my sample PDF documents and as per my observations, when viewing the resultant PDF file with OWNER password, the printing button, copy text and other options become enable. However when viewing the document through user password, the print button, copy text and other options become disabled.

In case you still face the issue, please share the resource PDF file which you are using so that we can test the scenario at our end. We are sorry for this inconvenience.

[C#]

//open
document
<o:p></o:p>

Document pdfDocument = new Document("c:/pdftest/PDF2.pdf");

Aspose.Pdf.Permissions _Permissions = new Aspose.Pdf.Permissions(); // nothing enabled

Aspose.Pdf.CryptoAlgorithm _CryptoAlgorithm = Aspose.Pdf.CryptoAlgorithm.AESx128;

pdfDocument.Encrypt("user", "owner", _Permissions, _CryptoAlgorithm);

pdfDocument.Save(“c:/pdftest/ProtectedFiel.pdf”);

Yes you have the same code as me.

but I am still getting the same result as before.

please try this attached pdf.

Hi Nitin,


Thanks for sharing the resource file.

I have tested the scenario using PDF document which you have shared earlier and as per my observations, the menu options are different/enabled when PDF document with OWNER password. For your reference, I have also attached the PDF document generated over my end.

In case the problem still persists, please feel free to contact.

using adobe reader i see the print is enabled
but the copy, cut etc are not - foe "owner"

I am using Adobe Reader v10.0

see attached screen for “owner”

Hi Nitin,


The copy option becomes visible/enabled when some text is selected from PDF. This option becomes disabled when no text is selected. Also please note that Print, Save as text option are only visible when viewing the document with Owner password.

oh ok - stupid me :-)

Thank you so much.