0

PDF Security Requirement

Hi I am using iTextSharp.text in c# and I have requirement to set the following security settings to the PDF that is generated. I have tried following but it sets password and still allows page extraction.

PDFEncryptor pdfe = new PDFEncryptor(null, ~(PdfWriter.AllowAssembly));
pdfImg= pdfe.Encrypt(pdfImg);

How to solve this?

AbdulM
  • 1
  • 7
  • are you trying to prevent editing of the PDF – MethodMan Nov 09 '15 at 19:54
  • Instead of picking the properties that you want to exclude and inverting the bit components, try just setting the explicit properties that you want to allow. [This post](http://stackoverflow.com/questions/22179177/disallow-editing-but-allow-page-extraction-in-java-itext-pdf) has a table of them and you can find their equivalent constants in the `PdfWriter` class. – Chris Haas Nov 09 '15 at 21:11
  • Additionally to what @ChrisHaas wrote, you also may want to read [Allow page extraction in a password security pdf with itextsharp](http://stackoverflow.com/questions/25783530/allow-page-extraction-in-a-password-security-pdf-with-itextsharp) where you'll find how the *bits* described in the PDF specification map to iText constants. – Bruno Lowagie Nov 10 '15 at 08:49
  • How can I set Security Method to "No security" in addition to the document restrictions? I am passing null to PDFEncyptor constructor but still is sets password. – AbdulM Nov 10 '15 at 16:13
  • I figured out that I should not encrypt at all. If I open the PDF with Adobe xl PRO everything listed is allowed but if I open with Acrobat reader 11.0.12 I see what I was looking for. – AbdulM Nov 11 '15 at 19:15

0 Answers0