I think I remember seeing this before... happens when calling save with some incomplete encryption settings. Could you please post the shortest possible code that reproduces the error, the version you are using, and upload the PDF you are using (if applicable) somewhere.

But if my memory is correct, the solution won't get the error away, instead there would be an IllegalStateException with a meaningful error message.

For an example about how to do encryption, see TestSymmetricKeyEncryption.java, and https://pdfbox.apache.org/1.8/cookbook/encryption.html

Tilman

Am 22.04.2015 um 00:38 schrieb Andrew Munn:
It looks like the StandardProtectionPolicy policy == null here:

  private int computeRevisionNumber() {
         return this.version < 2 &&
!this.policy.getPermissions().hasAnyRevision3PermissionSet()?2:(this.version
== 5?6:(this.version != 2 && this.version != 3 &&
!this.policy.getPermissions().hasAnyRevision3PermissionSet()?4:3));
     }

java.lang.NullPointerException
        at 
org.apache.pdfbox.pdmodel.encryption.StandardSecurityHandler.computeRevisionNumber(StandardSecurityHandler.java:129)
        at 
org.apache.pdfbox.pdmodel.encryption.StandardSecurityHandler.prepareDocumentForEncryption(StandardSecurityHandler.java:332)
        at org.apache.pdfbox.pdfwriter.COSWriter.write(COSWriter.java:1254)
        at org.apache.pdfbox.pdfwriter.COSWriter.write(COSWriter.java:1215)
        at org.apache.pdfbox.pdmodel.PDDocument.save(PDDocument.java:958)
        at org.apache.pdfbox.pdmodel.PDDocument.save(PDDocument.java:930)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to