pdfbox-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From William Heckle <William.Hec...@Tceq.Texas.Gov>
Subject Problem Setting Security
Date Mon, 27 Jul 2015 19:46:08 GMT

I am trying to construct a document that everyone can read and it is not modifiable.  I have
tried many combinations with no success. Using passwords and not using passwords; encrypting
and not encrypting, every combination doesn't matter. I am setting can modify equals false.
The original pdf is generated from a birt report, it doesn't add a security handler if that
is of issue. Below is the code that I thought would set the document to disable modification
and not allow anyone to modify it; however, Acrobat version 10.0.3 has no issue with writing
in the file then printing the modifications. I am using version 1.8.9 pdfBox.

PDDocument documentToProtect= PDDocument.load(document);
AccessPermission ap = new AccessPermission();
ap.setCanModify(false);
ap.setReadOnly();
StandardProtectionPolicy policy = new StandardProtectionPolicy("StandardProtectionPolicy","",
ap);
policy.setEncryptionKeyLength(128);
documentToProtect.protect(policy);
documentToProtect.save(document);
documentToProtect.close();


Bill Heckle
Programmer
TCEQ Information Resources Division
William.Heckle@TCEQ.Texas.gov
512.239.0874


Mime
  • Unnamed multipart/related (inline, None, 0 bytes)
View raw message