How to set the security for an existing PDF document

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

Hi Rajesh,


Thanks for your contacting support.

The ISO standard does not support disabling page extraction feature and therefore it can not be implemented in our API. The page extraction/creation of template page are supported in Adobe Pro (has GUI to accomplish these tasks), but Acrobat Reader does not offer this feature. Furthermore, also please note that Acrobat Reader does not offer the full functionality (in this case - page extraction), so the data of Security tab may be different against Adobe Pro.

As a workaround, you may consider displaying PDF files in ViewerApp of our sister company named GroupDocs and your users/customers will not be able to extract pages from respective PDF file. We are sorry for your inconvenience.

Dear team,


Thanks for the reply.

I just want to check one more thing. The documents which we generate require lot of security that the user should not be able to edit them. But having enabling the export PDF file to other file formats does that. The user can export the PDF file to word and edit it and then can convert back to PDF.

I am applying security on the PDF file that the user cannot edit it. So is there any way that even though the user can export the PDF file to Word document but the same security should be applied to the exported word document so that the user should not be able to edit it.

Thanks And Regards,
Rajesh


Hi Rajesh,


Thanks for sharing the details.

Aspose.Pdf deals with PDF file formats and PDF Specifications published by Adobe. However concerning to your requirement on porting same security restrictions to resultant Word or other file format, I have logged an investigation ticket in our issue tracking system as PDFNEWNET-38649. We will further look into this requirement and see if this feature can be accomplished.

As soon as we have some further updates, we will let you know.