diff options
author | Thomas <> | 2021-05-19 17:37:55 +0200 |
---|---|---|
committer | Thomas <> | 2021-05-19 17:37:55 +0200 |
commit | 77cc1a7b56632d36efba616d5fd8cf4aac93b30e (patch) | |
tree | 2645e11fc92513f13c2a2077f35ab78fd932cb56 /pdf-as-pdfbox-2/src/main/java/at/gv | |
parent | 8a8d467d6415c5b12262ad18ff7f21f6b07cdcd4 (diff) | |
download | pdf-as-4-77cc1a7b56632d36efba616d5fd8cf4aac93b30e.tar.gz pdf-as-4-77cc1a7b56632d36efba616d5fd8cf4aac93b30e.tar.bz2 pdf-as-4-77cc1a7b56632d36efba616d5fd8cf4aac93b30e.zip |
change analyzing of PDF protection level because it's maybe to restricted
Diffstat (limited to 'pdf-as-pdfbox-2/src/main/java/at/gv')
-rw-r--r-- | pdf-as-pdfbox-2/src/main/java/at/gv/egiz/pdfas/lib/impl/pdfbox2/utils/PdfBoxUtils.java | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/pdf-as-pdfbox-2/src/main/java/at/gv/egiz/pdfas/lib/impl/pdfbox2/utils/PdfBoxUtils.java b/pdf-as-pdfbox-2/src/main/java/at/gv/egiz/pdfas/lib/impl/pdfbox2/utils/PdfBoxUtils.java index 1a6499ac..d072a474 100644 --- a/pdf-as-pdfbox-2/src/main/java/at/gv/egiz/pdfas/lib/impl/pdfbox2/utils/PdfBoxUtils.java +++ b/pdf-as-pdfbox-2/src/main/java/at/gv/egiz/pdfas/lib/impl/pdfbox2/utils/PdfBoxUtils.java @@ -16,15 +16,18 @@ public class PdfBoxUtils { public static void checkPDFPermissions(PDDocument doc) throws PdfAsValidationException { - AccessPermission accessPermission = doc.getCurrentAccessPermission(); - if (doc.isEncrypted()) { - throw new PdfAsValidationException("error.pdf.sig.12", null); + if (doc.isEncrypted() || !accessPermission.isOwnerPermission()) { + if (accessPermission.canModify() || accessPermission.canModifyAnnotations() + || accessPermission.canFillInForm()) { + logger.debug("Document is protected, but Signing is allowed"); + + } else { + throw new PdfAsValidationException("error.pdf.sig.12", null); + + } } - if (!accessPermission.isOwnerPermission()) { - throw new PdfAsValidationException("error.pdf.sig.12", null); - } } |