pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From til...@apache.org
Subject svn commit: r1862287 - /pdfbox/branches/issue45/preflight/src/main/java/org/apache/pdfbox/preflight/annotation/AnnotationValidator.java
Date Fri, 28 Jun 2019 18:47:20 GMT
Author: tilman
Date: Fri Jun 28 18:47:20 2019
New Revision: 1862287

URL: http://svn.apache.org/viewvc?rev=1862287&view=rev
Log:
PDFBOX-4586: widget annotations must have an /AP

Modified:
    pdfbox/branches/issue45/preflight/src/main/java/org/apache/pdfbox/preflight/annotation/AnnotationValidator.java

Modified: pdfbox/branches/issue45/preflight/src/main/java/org/apache/pdfbox/preflight/annotation/AnnotationValidator.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/issue45/preflight/src/main/java/org/apache/pdfbox/preflight/annotation/AnnotationValidator.java?rev=1862287&r1=1862286&r2=1862287&view=diff
==============================================================================
--- pdfbox/branches/issue45/preflight/src/main/java/org/apache/pdfbox/preflight/annotation/AnnotationValidator.java
(original)
+++ pdfbox/branches/issue45/preflight/src/main/java/org/apache/pdfbox/preflight/annotation/AnnotationValidator.java
Fri Jun 28 18:47:20 2019
@@ -27,6 +27,7 @@ import org.apache.pdfbox.cos.COSDocument
 import org.apache.pdfbox.cos.COSName;
 import org.apache.pdfbox.pdmodel.graphics.form.PDFormXObject;
 import org.apache.pdfbox.pdmodel.interactive.annotation.PDAnnotation;
+import org.apache.pdfbox.pdmodel.interactive.annotation.PDAnnotationWidget;
 import org.apache.pdfbox.pdmodel.interactive.annotation.PDAppearanceDictionary;
 import org.apache.pdfbox.preflight.PreflightContext;
 import org.apache.pdfbox.preflight.ValidationResult.ValidationError;
@@ -35,7 +36,6 @@ import org.apache.pdfbox.preflight.graph
 import org.apache.pdfbox.preflight.utils.COSUtils;
 import org.apache.pdfbox.preflight.utils.ContextHelper;
 
-
 import static org.apache.pdfbox.preflight.PreflightConfiguration.ACTIONS_PROCESS;
 import static org.apache.pdfbox.preflight.PreflightConfiguration.GRAPHIC_PROCESS;
 import static org.apache.pdfbox.preflight.PreflightConstants.ANNOT_DICTIONARY_VALUE_SUBTYPE_POPUP;
@@ -238,6 +238,15 @@ public abstract class AnnotationValidato
                 }
             }
         }
+        else if (this.pdAnnot instanceof PDAnnotationWidget && this.pdAnnot.getAppearance()
== null)
+        {
+            // https://www.pdfa.org/wp-content/uploads/2017/07/TechNote0010.pdf
+            // "An ISO 19005-1 validator shall FAIL otherwise conforming files in which a
+            //  widget annotation lacks an appearance dictionary." (page 17)
+            ctx.addValidationError(new ValidationError(ERROR_ANNOT_INVALID_AP_CONTENT,
+                    "widget annotation lacks an appearance dictionary"));
+            return false;
+        }
         // else ok, nothing to check, this field is optional
         return true;
     }



Mime
View raw message