7

I don't know if it is possible to create a pdf with password security enabled, that also allows extraction of pages.

I havn't found any property in itextsharp which will allow enable page extraction.

Any one has any idea?

properties

This is the property that i would like to enable.

Thank you very much.

Sean C
  • 59
  • 11
Ruben de la Fuente
  • 695
  • 11
  • 23
  • Which version of Acrobat is this? The draft for ISO-32000-2 states: bit 5 defines the permission to *Copy or otherwise extract text and graphics from the document. However, for the limited purpose of providing this content to assistive technology, a PDF reader should behave as if this bit was set to 1.* I am confused to see that Accessibility is enabled and at the same time page extraction is not allowed. This was possible in ISO-32000-1, but this will be deprecated in ISO-32000-2 (hence you shouldn't depend on that flag). – Bruno Lowagie Sep 11 '14 at 11:41
  • Hi, I am using Adobe Acrobat Reader 9.4.0 and my document is based in specification (PDF 1.4). – Ruben de la Fuente Sep 11 '14 at 12:41
  • 1
    I've investigated your problem. You seem to be asking something that is impossible. Moreover: your requirement isn't full-proof. Anyone who wants to extract pages can remove an owner password. – Bruno Lowagie Sep 11 '14 at 12:45
  • Thank you very much, I also think it is not possible to allow extract pages while using password security. But did not know much about the restrictions from pdf documents – Ruben de la Fuente Sep 11 '14 at 13:00
  • Well, it's an interesting question. I've learned something I didn't know myself ;-) – Bruno Lowagie Sep 11 '14 at 13:01
  • I think a page extracted from a secured Pdf would be removed off all security restriction. That's why extraction is not allowed. – Silent Sojourner Feb 22 '18 at 16:35

2 Answers2

3

I've taken a look at the permission bits in the draft of ISO-32000-2 and I've compared them with the parameters (written in ALL_CAPS) available in iText:

bit 1:  Not assigned
bit 2:  Not assigned
bit 3:  Degraded printing: ALLOW_DEGRADED_PRINTING
bit 4:  Modify contents: ALLOW_MODIFY_CONTENTS
bit 5:  Extract text / graphics: ALLOW_COPY
bit 6:  Add / Modify text annotations: ALLOW_MODIFY_ANNOTATIONS
bit 7:  Not assigned
bit 8:  Not assigned
bit 9:  Fill in fields: ALLOW_FILL_IN
bit 10: **Deprecated** ALLOW_SCREEN_READERS
bit 11: Assembly: ALLOW_ASSEMBLY
bit 12: Printing: ALLOW_PRINTING

When I compare the spec with your screen shot, I assume that the permissions are as follows:

  • Printing: ALLOW_DEGRADED_PRINTING or ALLOW_PRINTING
  • Changing the document: ALLOW_MODIFY_CONTENTS
  • Commenting: ALLOW_MODIFY_ANNOTATIONS
  • Form Field Fill-in or Signing: ALLOW_FILL_IN
  • Document Assembly: ALLOW_ASSEMBLY
  • Content copying: ALLOW_COPY
  • Content Accessibility Enabled: ALLOW_SCREENREADERS

I can't find any permission bit that refers to page extraction. I have tried setting all the flags that are documented in ISO-32000-2, but they didn't result in setting the Page Extraction to Allowed.

I have tried two things:

First I tried setting the bits that aren't assigned: bit 1, 2, 7, 8, 13, 14. This didn't change anything. Then I opened a test document in Acrobat and I tried finding a setting that would allow page extraction:

enter image description here

I couldn't find any.

As the permission isn't described in ISO-32000 and as there doesn't seem to be a way to set this permission in Acrobat, I'm inclined to believe that there is no way to set this permission. The only way to see "Allowed", is to open the document with the owner password.

Please update your question as soon as you find a way to set this permission with Acrobat. I'm using Acrobat XI Pro.

On another note: setting the permissions the way you do (using only an owner password and without a user password) is only a psychological, NOT a full-proof technical way to enforce protection. See How to read PDFs created with an unknown random owner password? to find out how to remove permissions from a PDF that is only protected using an owner password.

Community
  • 1
  • 1
Bruno Lowagie
  • 75,994
  • 9
  • 109
  • 165
0

To secure a PDF file using iTextSharp, while allowing the users to extract text and images, but stop them from editing, saving and printing the PDF file, I do this -

//Obviously, use the correct namespace
using iTextSharp.text.pdf;


//Create an instance of PdfReader, associate your PDF file
PdfReader reader = new PdfReader(“yourFile.PDF”);

//Secure your file with a password(yourPDFpassword), set the security to
// PdfWriter.ALLOW_COPY – to allow for security with content extraction

PdfEncryptor.Encrypt(reader, output, true, "", yourPDFpassword, PdfWriter.ALLOW_COPY);
A.L
  • 10,259
  • 10
  • 67
  • 98
Mr.L
  • 1
  • 2