Package org.apache.padaf.preflight.ValidationResult

Examples of org.apache.padaf.preflight.ValidationResult.ValidationError


            (COSObject) destOutputProfile))) {
          // ---- the profile is already checked. continue
          return null;
        } else if (!mapDestOutputProfile.isEmpty()) {
          // ---- A DestOutputProfile exits but it isn't the same, error
          return new ValidationError(
              ERROR_GRAPHIC_OUTPUT_INTENT_ICC_PROFILE_MULTIPLE, "More than one ICCProfile is defined");
        }
        // else  the profile will be kept in the tmpDestOutputProfile if it is valid
      }

      PDStream stream = PDStream.createFromCOS(COSUtils.getAsStream(
          destOutputProfile, cDoc));
      if (stream == null) {
        return new ValidationError(ERROR_GRAPHIC_OUTPUT_INTENT_INVALID_ENTRY,
            "OutputIntent object uses a NULL Object");
      }

      ICC_Profile iccp = ICC_Profile.getInstance(stream.getByteArray());
      // check the ICC Profile version (6.2.2)
      if (iccp.getMajorVersion() == 2) {
        if (iccp.getMinorVersion() > 0x40) {
          // TODO on lazy mode this error should be a warning?
          // in PDF 1.4, max version is 02h.40h (meaning V 3.5)
          // see the ICCProfile specification (ICC.1:1998-09)page 13 - §6.1.3 :
          // The current profile version number is "2.4.0" (encoded as 02400000h"
          return new ValidationError(
              ERROR_GRAPHIC_OUTPUT_INTENT_ICC_PROFILE_TOO_RECENT, "Invalid version of the ICCProfile");
        } // else OK
      } else if (iccp.getMajorVersion() > 2) {
        // TODO on lazy mode this error should be a warning?
        // in PDF 1.4, max version is 02h.40h (meaning V 3.5)
        // see the ICCProfile specification (ICC.1:1998-09)page 13 - §6.1.3 :
        // The current profile version number is "2.4.0" (encoded as 02400000h"
        return new ValidationError(
            ERROR_GRAPHIC_OUTPUT_INTENT_ICC_PROFILE_TOO_RECENT, "Invalid version of the ICCProfile");
      } // else seems less than 2, so correct

      if (handler.getIccProfileWrapper() == null) {
        handler.setIccProfileWrapper(new ICCProfileWrapper(iccp));
      }
     
      // ---- keep reference to avoid multiple profile definition
      mapDestOutputProfile.put(new COSObjectKey((COSObject) destOutputProfile),
          true);

    } catch (IllegalArgumentException e) {
      // ---- this is not a ICC_Profile
      return new ValidationError(
          ERROR_GRAPHIC_OUTPUT_INTENT_ICC_PROFILE_INVALID, "DestOutputProfile isn't a ICCProfile");
    } catch (IOException e) {
      throw new ValidationException("Unable to parse the ICC Profile", e);
    }
View Full Code Here


            StringBuilder sb = new StringBuilder(80);
            sb
            .append("FontName")
            .append(
            " present in the FontDescriptor dictionary doesn't match with XMP information dc:title of the Font File Stream.");
            ve.add(new ValidationError(
                ValidationConstants.ERROR_METADATA_MISMATCH, sb.toString()));
            return false;
          }

          // --- default value is the right one
          return true;
        } else {
          Iterator<AbstractField> it = dc.getTitle().getContainer()
          .getAllProperties().iterator();
          boolean empty = true;
          while (it.hasNext()) {
            empty = false;
            AbstractField tmp = it.next();
            if (tmp != null && tmp instanceof TextType) {
              if (((TextType) tmp).getStringValue().equals(fontName)
                  || (noSubSetName != null && ((TextType) tmp).getStringValue()
                      .equals(noSubSetName))) {
                // value found, return
                return true;
              }
            }
          }

          // title doesn't match, it is an error.
          StringBuilder sb = new StringBuilder(80);
          sb.append("FontName");
          if (empty) {
            sb
            .append(" present in the FontDescriptor dictionary can't be found in XMP information the Font File Stream.");
            ve.add(new ValidationError(
                ValidationConstants.ERROR_METADATA_PROPERTY_MISSING, sb
                .toString()));
          } else {
            sb
            .append(" present in the FontDescriptor dictionary doesn't match with XMP information dc:title of the Font File Stream.");
            ve.add(new ValidationError(
                ValidationConstants.ERROR_METADATA_MISMATCH, sb.toString()));
          }
          return false;
        }
      }
View Full Code Here

    if (dc != null) {
      ComplexProperty copyrights = dc.getRights();
      if (copyrights == null || copyrights.getContainer() == null
          || copyrights.getContainer().getAllProperties().isEmpty()) {
        ve
        .add(new ValidationError(
            ValidationConstants.ERROR_METADATA_PROPERTY_MISSING,
        "CopyRights is missing from the XMP information (dc:rights) of the Font File Stream."));
        return false;
      }
    }

    XMPRightsManagementSchema rights = metadata.getXMPRightsManagementSchema();
    if (rights != null) {
      BooleanType marked = rights.getMarked();
      if (marked != null && !marked.getValue()) {
        ve
        .add(new ValidationError(
            ValidationConstants.ERROR_METADATA_PROPERTY_MISSING,
        "the XMP information (xmpRights:Marked) is invalid for the Font File Stream."));
        return false;
      }
View Full Code Here

   * net.awl.edoc.pdfa.validation.actions.AbstractActionManager#valid(java.util
   * .List)
   */
  @Override
  protected boolean innerValid(List<ValidationError> error) {
    error.add(new ValidationError(ERROR_ACTION_FORBIDDEN_ACTIONS_EXPLICITLY_FORBIDDEN, "The action "
        + actionName + " is forbidden"));
    return false;
  }
View Full Code Here

  @Override
  protected boolean innerValid(List<ValidationError> error) {
    COSBase uri = this.actionDictionnary.getItem(COSName
        .getPDFName(ACTION_DICTIONARY_KEY_URI));
    if (uri == null) {
      error.add(new ValidationError(ERROR_ACTION_MISING_KEY,
          "URI entry is mandatory for the UriAction"));
      return false;
    }

    if (!COSUtils.isString(uri, cDoc)) {
      error.add(new ValidationError(ERROR_ACTION_INVALID_TYPE, "URI entry should be a string"));
      return false;
    }

    return true;
  }
View Full Code Here

        .getPDFName(TRANSPARENCY_DICTIONARY_KEY_SOFT_MASK));
    //
    if (smask != null
        && !(COSUtils.isString(smask, cosDocument) && TRANSPARENCY_DICTIONARY_VALUE_SOFT_MASK_NONE
            .equals(COSUtils.getAsString(smask, cosDocument)))) {
      error.add(new ValidationError(ERROR_GRAPHIC_TRANSPARENCY_SMASK, "Soft Mask must be null or None"));
      return false;
    }

    return true;
  }
View Full Code Here

   * @return true if the OPI is missing, false otherwise.
   */
  protected boolean checkOPI(List<ValidationError> errors) {
    // 6.2.4 and 6.2.5 no OPI
    if (this.xobject.getItem(COSName.getPDFName("OPI")) != null) {
      errors.add(new ValidationError(
          ValidationConstants.ERROR_GRAPHIC_UNEXPECTED_KEY,
          "Unexpected 'OPI' Key"));
      return false;
    }
    return true;
View Full Code Here

   * @return true if the Ref is missing, false otherwise.
   */
  protected boolean checkReferenceXObject(List<ValidationError> errors) {
    // 6.2.6 No reference xobject
    if (this.xobject.getItem(COSName.getPDFName("Ref")) != null) {
      errors.add(new ValidationError(ERROR_GRAPHIC_UNEXPECTED_KEY,
          "No reference Xobject allowed in PDF/A"));
      return false;
    }
    return true;
  }
View Full Code Here

  protected boolean checkPostscriptXObject(List<ValidationError> errors) {
    // 6.2.7 No PostScript XObjects
    if (this.xobject.getItem(COSName.SUBTYPE) != null
        && XOBJECT_DICTIONARY_VALUE_SUBTYPE_POSTSCRIPT.equals(this.xobject
            .getNameAsString(COSName.SUBTYPE))) {
      errors.add(new ValidationError(ERROR_GRAPHIC_UNEXPECTED_VALUE_FOR_KEY,
          "No Postscript Xobject allowed in PDF/A"));
      return false;
    }
    if (this.xobject.getItem(COSName.getPDFName("Subtype2")) != null) {
      errors.add(new ValidationError(ERROR_GRAPHIC_UNEXPECTED_VALUE_FOR_KEY,
          "No Postscript Xobject allowed in PDF/A (Subtype2)"));
      return false;
    }
    return true;
  }
View Full Code Here

  @Override
  protected boolean innerValid(List<ValidationError> error) {
    COSBase f = this.actionDictionnary.getItem(COSName
        .getPDFName(ACTION_DICTIONARY_KEY_F));
    if (f == null) {
      error.add(new ValidationError(ERROR_ACTION_MISING_KEY,
          "F entry is mandatory for the SubmitActions"));
      return false;
    }
    return true;
  }
View Full Code Here

TOP

Related Classes of org.apache.padaf.preflight.ValidationResult.ValidationError

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.