/** * Checks if all mandatory fields of an annotation are present. If some fields are missing, the method returns false * and the errors list is updated. * * @return true if validation succeed, false otherwise. */ protected boolean checkMandatoryFields() { boolean subtype = this.annotDictionary.containsKey(COSName.SUBTYPE); boolean rect = this.annotDictionary.containsKey(COSName.RECT); boolean result = (subtype && rect && checkSpecificMandatoryFields()); if (!result) { ctx.addValidationError(new ValidationError(ERROR_ANNOT_MISSING_FIELDS, "A mandatory field for the " + this.pdAnnot.getSubtype() + " annotation is missing")); } return result; }
/** * Checks if flags of the annotation are authorized. * <UL> * <li>Print flag must be 1 * <li>NoView flag must be 0 * <li>Hidden flag must be 0 * <li>Invisible flag must be 0 * </UL> * If one of these flags is invalid, the errors list is updated with the ERROR_ANNOT_FORBIDDEN_FLAG ValidationError * code. * * @return false if a flag is invalid, true otherwise. */ protected boolean checkFlags() { boolean result = this.pdAnnot.isPrinted(); result = result && !this.pdAnnot.isHidden(); result = result && !this.pdAnnot.isInvisible(); result = result && !this.pdAnnot.isNoView(); if (!result) { ctx.addValidationError(new ValidationError(ERROR_ANNOT_FORBIDDEN_FLAG, "Flags of " + pdAnnot.getSubtype() + " annotation are invalid")); } return result; }
@Override public String getSubtype() { if (annot != null) { return annot.getSubtype(); } return null; }
/** * Checks if all mandatory fields of an annotation are present. If some fields are missing, the method returns false * and the errors list is updated. * * @return true if validation succeed, false otherwise. */ protected boolean checkMandatoryFields() { boolean subtype = this.annotDictionary.containsKey(COSName.SUBTYPE); boolean rect = this.annotDictionary.containsKey(COSName.RECT); boolean result = (subtype && rect && checkSpecificMandatoryFields()); if (!result) { ctx.addValidationError(new ValidationError(ERROR_ANNOT_MISSING_FIELDS, "A mandatory field for the " + this.pdAnnot.getSubtype() + " annotation is missing")); } return result; }
/** * Checks if all mandatory fields of an annotation are present. If some fields are missing, the method returns false * and the errors list is updated. * * @return true if validation succeed, false otherwise. */ protected boolean checkMandatoryFields() { boolean subtype = this.annotDictionary.containsKey(COSName.SUBTYPE); boolean rect = this.annotDictionary.containsKey(COSName.RECT); boolean result = (subtype && rect && checkSpecificMandatoryFields()); if (!result) { ctx.addValidationError(new ValidationError(ERROR_ANNOT_MISSING_FIELDS, "A mandatory field for the " + this.pdAnnot.getSubtype() + " annotation is missing")); } return result; }
/** * Checks if flags of the annotation are authorized. * <UL> * <li>Print flag must be 1 * <li>NoView flag must be 0 * <li>Hidden flag must be 0 * <li>Invisible flag must be 0 * </UL> * If one of these flags is invalid, the errors list is updated with the ERROR_ANNOT_FORBIDDEN_FLAG ValidationError * code. * * @return false if a flag is invalid, true otherwise. */ protected boolean checkFlags() { boolean result = this.pdAnnot.isPrinted(); result = result && !this.pdAnnot.isHidden(); result = result && !this.pdAnnot.isInvisible(); result = result && !this.pdAnnot.isNoView(); if (!result) { ctx.addValidationError(new ValidationError(ERROR_ANNOT_FORBIDDEN_FLAG, "Flags of " + pdAnnot.getSubtype() + " annotation are invalid")); } return result; }
/** * Checks if flags of the annotation are authorized. * <UL> * <li>Print flag must be 1 * <li>NoView flag must be 0 * <li>Hidden flag must be 0 * <li>Invisible flag must be 0 * </UL> * If one of these flags is invalid, the errors list is updated with the ERROR_ANNOT_FORBIDDEN_FLAG ValidationError * code. * * @return false if a flag is invalid, true otherwise. */ protected boolean checkFlags() { boolean result = this.pdAnnot.isPrinted(); result = result && !this.pdAnnot.isHidden(); result = result && !this.pdAnnot.isInvisible(); result = result && !this.pdAnnot.isNoView(); if (!result) { ctx.addValidationError(new ValidationError(ERROR_ANNOT_FORBIDDEN_FLAG, "Flags of " + pdAnnot.getSubtype() + " annotation are invalid")); } return result; }
public PBoxPDAnnot(PDAnnotation annot, PDResources pageResources, PDDocument document, PDFAFlavour flavour) { super(annot, ANNOTATION_TYPE); this.pageResources = pageResources; this.subtype = annot.getSubtype(); this.ap = getAP(annot); COSDictionary annotDict = annot.getCOSObject(); this.isFKeyPresent = annotDict.containsKey(COSName.F); this.annotationFlag = annot.getAnnotationFlags(); this.ca = PBoxPDAnnot.getCA(annot); this.nType = getN_type(annot); this.ft = PBoxPDAnnot.getFT(annot); this.width = PBoxPDAnnot.getWidth(annot); this.height = PBoxPDAnnot.getHeight(annot); this.document = document; this.flavour = flavour; }
if (annotation instanceof PDAnnotationMarkup && annotation.getSubtype().equals(PDAnnotationMarkup.SUB_TYPE_INK))
if (annotation instanceof PDAnnotationMarkup && annotation.getSubtype().equals(PDAnnotationMarkup.SUB_TYPE_INK))
if ((o instanceof PDAnnotation) && PDAnnotationMarkup.SUB_TYPE_FREETEXT.equals(((PDAnnotation) o).getSubtype())) {
if ((o instanceof PDAnnotation) && PDAnnotationMarkup.SUB_TYPE_FREETEXT.equals(((PDAnnotation) o).getSubtype())) {