I use iText to create PDF files. I want to disable PDF editing, but allow the reader to extract pages. Here is my code to set the encryption:
writer.setEncryption(null, null, 0xffffffff, PdfWriter.STANDARD_ENCRYPTION_128);
The third parameter indicates permissions. I use 0xffffffff instead of individual iText ALLOW_PRINTING flags, etc. This will ask iText to include everything. But this is what I get in the PDF file:

I should think that I am allowed to enable extraction, but disable editing, but I'm not sure. Below are the permission bits for Adobe: 

(From here , but be warned about it 30 meg)
So turn off bits 6 and 11, but leave it on the rest (especially bits 5 and 10), and this will disable editing, but allow extraction. In any case, specifying 0xffffffff, I would have thought that everything would be allowed; but instead, only an exception exception is allowed.
I took the source code of iText for setting permissions and see nothing that could cause this. Here is the relevant code from PdfEncryption.setupAllKeys:
permissions |= (revision == STANDARD_ENCRYPTION_128 || revision == AES_128 || revision == AES_256) ? 0xfffff0c0 : 0xffffffc0; permissions &= 0xfffffffc;
The first line executes OR and therefore will not remove any permissions; the second line sets the two extreme bites to 0 according to the PDF specification.
I am wondering if this is an iText thing, a thing in PDF format, or if I am doing something else wrong.
thanks