PreflightPath vPath = context.getValidationPath();
XObjectValidator validator = null;
if (!vPath.isEmpty() && vPath.isExpectedType(PDImageXObject.class))
{
validator = new XObjImageValidator(context, (PDImageXObject) vPath.peek());
}
else if (!vPath.isEmpty() && vPath.isExpectedType(PDFormXObject.class))
{
validator = new XObjFormValidator(context, (PDFormXObject) vPath.peek());
}