Hi team,
How I can change security on a PDF I have developed, I need to change the signing part of the properties to - allowed, instead of not allowed.
Hi team,
How I can change security on a PDF I have developed, I need to change the signing part of the properties to - allowed, instead of not allowed.
Hi there,
Thanks for your inquiry. You can use PdfFileSecurity object to set privileges on existing PDF document. Please check following code snippet for enabling signing privilege and also visit documentation link for further details.
//create DocumentPrivileges object
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.