1. A method of automatic document classification using computer performing the steps of: automatically obtaining the salient features of the document image layout, said features consisting of text blocks, geometric line segments and the contents (sets of words) of said text blocks; using said feature to define distances between document images; automatically creating a plurality of classification template images based on said features; generating a ranked list of candidate templates best matching a given input document image in such a way that the classification template most similar to the document to be classified is at the top of the list, the next likely candidate template is in the second position and so forth; classifying the input image as belonging to the class of the top template in the said ranked list of templates.