Hi team,
This message was posted using Email2Forum by Babar Raza.
Hi team,
Hi there,
//create DocumentPrivileges object<o:p></o:p>
DocumentPrivilege privilege = DocumentPrivilege.ForbidAll;
privilege.AllowModifyAnnotations = true;
//open PDF document
PdfFileSecurity fileSecurity = new PdfFileSecurity();
fileSecurity.BindPdf(myDir + "input.pdf");
//set document privileges
fileSecurity.SetPrivilege(privilege);
fileSecurity.Save(myDir + "output.pdf");
Pelase feel free to contact us for any further assistance.
Best Regards,
Hi,
<o:p> </o:p>
// Load a source PDF file
using (Document document = new Document("c:/pdftest/Test (4).pdf"))
{
// Instantiate Document Privileges object
// Apply restrictions on all privileges
DocumentPrivilege documentPrivilege = DocumentPrivilege.AllowAll;
// make any changes except page extraction
documentPrivilege.ChangeAllowLevel= 4;
// Encrypt the file with User and Owner password.
// Need to set the password, so that once the user views the file with user password,
// only screen reading option is enabled
document.Encrypt("user", "owner", documentPrivilege, CryptoAlgorithm.AESx128,true);
// Save updated document
document.Save("c:/pdftest/TempFile_Secured.pdf");
}
When viewing the security permissions of resultant file, you will get information as specified in attached image. In case you encounter any issue, please share the resource PDF file.