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

Free Support Forum - aspose.com

Problems Prohibiting document copying and editing functionality

I have following code

private Document EncryptPDF(Document document, string password)
var documentPrivilege = DocumentPrivilege.ForbidAll;
document.Encrypt(userPassword: password, ownerPassword: null, privileges: documentPrivilege,
cryptoAlgorithm: CryptoAlgorithm.AESx128, usePdf20: false);
       <span style="color:blue;">return</span> document;
   }</pre><pre style="font-family: Consolas; font-size: 13px; background: white;"><br></pre><pre style="font-family: Consolas; font-size: 13px; background: white;">I'm expecting whole pdf document to be secure (no copying, no editing ) 

But when i open the document i can copy and paste the document to word doc

What am i missing?

Also i can see everything allowed in Document properties -> Document Restriction Summary except
Document Assembly : Not Allowed
Page Extraction : Not Allowed

We are using Aspose.net C# runtime v4.0.30319

Hi There,

Thanks for contacting support.

I have tested the scenario with one sample PDF file using Aspose.Pdf for .NET 17.4.0 and have managed to restrict PDF files from editing, copying etc. I have attached the output file for your reference. I will appreciate if you please share your sample PDF file Please note It is recommended to use the latest version for Aspose API as all bugs and improvements are part of latest releases.

We are sorry for this inconvenience.

Best Regards,

Is your nuget packages different from this link? because we tried nuget Aspose.net pdf and it has different method signatures from the link you gave.


Thank you for the inquiry. We have published the same version 17.4.0 of Aspose.Pdf for .NET API in the Nuget gallery. Please list down all differences of method signatures which you find at your end. We shall investigate and reply you appropriately. Your response is awaited.

Got the latest license when i installed nuget Aspose.pdf now i get

Severity Code Description Project File Line Suppression State
Error CS0234 The type or namespace name ‘Generator’ does not exist in the namespace ‘Aspose.Pdf’ (are you missing an assembly reference?)

And all the lines that has Generator appears missing. Is missing Generator?
Aspose.Pdf.Generator.Pdf pdf = new Aspose.Pdf.Generator.Pdf();

Do I have to install only Aspose.Pdf nuget package or more than that?


Thank you for the inquiry. Aspose.Pdf.Generator namespace was an old legacy approach which was also marked as obsolete. In the past, we had recommended our clients to migrate from Aspose.Pdf.Generator approach to Aspose.Pdf for .NET DOM approach. Kindly see developer’s guide section about the DOM approach: Working with Aspose.Pdf

We also document the changes of each new version of Aspose.Pdf for .NET API. Please refer to the release note section: Release Notes of Aspose.Pdf for .NET API. Furthermore, if you do not find an alternative code example in the developer’s guide of the new DOM approach, then please let us know, we will assist you appropriately.