return validator.validate();
}
public List<ValidationError> validateXObject(DocumentHandler handler,
COSObject cObj) throws ValidationException {
XObjectValidator xObjVal = null;
// ---- According to the XObject subtype, the validation isn't processed by
// the same Validator
COSStream dic = (COSStream) cObj.getObject();
String subtype = dic.getNameAsString(COSName
.getPDFName(DICTIONARY_KEY_SUBTYPE));
if (XOBJECT_DICTIONARY_VALUE_SUBTYPE_IMG.equals(subtype)) {
xObjVal = new XObjImageValidator(handler, dic);
} else if (XOBJECT_DICTIONARY_VALUE_SUBTYPE_FORM.equals(subtype)) {
xObjVal = new XObjFormValidator(handler, dic);
} else if (XOBJECT_DICTIONARY_VALUE_SUBTYPE_POSTSCRIPT.equals(subtype)) {
xObjVal = new XObjPostscriptValidator(handler, dic);
} else {
throw new ValidationException("Invalid XObject subtype");
}
return xObjVal.validate();
}