Preprocessing Framework for Document Image Analysis