Quantcast
Channel: Aspose.Pdf Product Family
Viewing all articles
Browse latest Browse all 3131

How to set the security for an existing PDF document.

$
0
0
Dear Team,

I want to set security for an existing PDF document.

As part of it. I want to disable the Editing, disable adding images, and want to disable extracting the PDF document to any other file formats.

Aspose.Pdf.Document pdfDoc = new Aspose.Pdf.Document(docLocation);
 DocumentPrivilege documentPrivilege = DocumentPrivilege.ForbidAll;
           documentPrivilege.AllowScreenReaders = true;
            documentPrivilege.AllowPrint = true;
            documentPrivilege.AllowCopy = true;
            
            pdfDoc.Encrypt("", "asc", documentPrivilege, CryptoAlgorithm.AESx256, false);
            
             pdfDoc.Save(docLocation);

Having used the above code I am actually able to forbid the user from editing the document. But I am not able to forbid the user from extracting the PDF document to any other file formats.

Could you please give a sample code to achieve this functionality.

Regards,
Rajesh

Viewing all articles
Browse latest Browse all 3131

Trending Articles