detecting distance to paper