Package org.apache.padaf.preflight.ValidationResult

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


    if (bmVal != null) {
      // ---- Blend Mode is valid only if it is equals to Normal or Compatible
      if (!(bmVal instanceof COSName && (TRANSPARENCY_DICTIONARY_VALUE_BM_NORMAL
          .equals(((COSName) bmVal).getName()) || TRANSPARENCY_DICTIONARY_VALUE_BM_COMPATIBLE
          .equals(((COSName) bmVal).getName())))) {
        error.add(new ValidationError(ERROR_TRANSPARENCY_EXT_GS_BLEND_MODE,"BlendMode value isn't valid (only Normal and Compatible are authorized)"));
        return false;
      }
    }
    return true;
  }
View Full Code Here


    if (uCA != null) {
      // ---- If CA is present only the value 1.0 is authorized
      Float fca = COSUtils.getAsFloat(uCA, cDoc);
      Integer ica = COSUtils.getAsInteger(uCA, cDoc);
      if (!(fca != null && fca == 1.0f) && !(ica != null && ica == 1)) {
        error.add(new ValidationError(ERROR_TRANSPARENCY_EXT_GS_CA,"CA entry in a ExtGState is invalid"));
        return false;
      }
    }

    if (lCA != null) {
      // ---- If ca is present only the value 1.0 is authorized
      Float fca = COSUtils.getAsFloat(lCA, cDoc);
      Integer ica = COSUtils.getAsInteger(lCA, cDoc);
      if (!(fca != null && fca == 1.0f) && !(ica != null && ica == 1)) {
        error.add(new ValidationError(ERROR_TRANSPARENCY_EXT_GS_CA,"ca entry in a ExtGState  is invalid."));
        return false;
      }
    }
    return true;
  }
View Full Code Here

   *          the list of error to update if the validation fails.
   * @return true if TR entry is missing, false otherwise.
   */
  protected boolean checkTRKey(COSDictionary egs, List<ValidationError> error) {
    if (egs.getItem(COSName.getPDFName("TR")) != null) {
      error.add(new ValidationError(
          ValidationConstants.ERROR_GRAPHIC_UNEXPECTED_KEY,
          "No TR key expected in Extended graphics state"));
      return false;
    }
    return true;
View Full Code Here

   */
  protected boolean checkTR2Key(COSDictionary egs, List<ValidationError> error) {
    if (egs.getItem(COSName.getPDFName("TR2")) != null) {
      String s = egs.getNameAsString(COSName.getPDFName("TR2"));
      if (!"default".equals(s)) {
        error.add(new ValidationError(
            ValidationConstants.ERROR_GRAPHIC_UNEXPECTED_VALUE_FOR_KEY,
            "TR2 key only expect 'default' value, not '" + s + "'"));
        return false;
      }
    }
View Full Code Here

   */
  protected boolean checkRIKey(COSDictionary egs, List<ValidationError> error) {
    String rendenringIntent = egs.getNameAsString(COSName.getPDFName("RI"));
    if (rendenringIntent != null && !"".equals(rendenringIntent)
        && !RenderingIntents.contains(rendenringIntent)) {
      error.add(new ValidationError(
          ValidationConstants.ERROR_GRAPHIC_UNEXPECTED_VALUE_FOR_KEY,
          "Invalid rendering intent value in Extended graphics state"));
      return false;
    }
    return true;
View Full Code Here

  protected boolean innerValid(List<ValidationError> error) {
    if (super.innerValid(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 GoToRemoteActions"));
        return false;
      }
    }
    return true;
View Full Code Here

  public List<ValidationError> validatePDFAIdentifer(XMPMetadata metadata)
      throws ValidationException {
    List<ValidationError> ve = new ArrayList<ValidationError>();
    PDFAIdentificationSchema id = metadata.getPDFIdentificationSchema();
    if (id == null) {
      ve.add(new ValidationError(ValidationConstants.ERROR_METADATA_PDFA_ID_MISSING));
      return ve;
    }

    // According to the PDF/A specification, the prefix must be pdfaid for this schema.
    if (!id.getPrefix().equals(PDFAIdentificationSchema.IDPREFIX)) {
View Full Code Here

      String prefExpected, String schema) {
    StringBuilder sb = new StringBuilder(80);
    sb.append(schema).append(" found but prefix used is '").append(prefFound)
        .append("', prefix '").append(prefExpected).append("' is expected.");

    return new ValidationError(
        ValidationConstants.ERROR_METADATA_WRONG_NS_PREFIX, sb.toString());
  }
View Full Code Here

        ValidationConstants.ERROR_METADATA_WRONG_NS_PREFIX, sb.toString());
  }

  protected void checkConformanceLevel(List<ValidationError> ve, String value) {
    if (!(value.equals("A") || value.equals("B"))) {
      ve.add(new ValidationError(
          ValidationConstants.ERROR_METADATA_INVALID_PDFA_CONFORMANCE));
    }
  }
View Full Code Here

  public static boolean isAuthorizedFilter(String filter, List<ValidationError> errors) {
    String errorCode = isAuthorizedFilter(filter);
    if (errorCode != null) {
      // --- LZW is forbidden.
      if ( ERROR_SYNTAX_STREAM_INVALID_FILTER.equals(errorCode) ) {
        errors.add(new ValidationError(ERROR_SYNTAX_STREAM_INVALID_FILTER, "LZWDecode is forbidden"));
        return false;
      } else {
        errors.add(new ValidationError(ERROR_SYNTAX_STREAM_UNDEFINED_FILTER, "This filter isn't defined in the PDF Reference Third Edition : "+filter));
        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.