1. A computer-readable medium storing a program for analyzing layout of text on a document image to extract text blocks for character recognition purposes, the program causing a computer to function as: an extraction condition memory storing a plurality of extraction conditions for use in extracting text blocks from a given document image; a text block extractor that extracts a plurality of sets of text blocks from the given document image in accordance with the plurality of extraction conditions stored in said extraction condition memory; and a text block consolidator that produces a consolidated set of text blocks by performing character recognition on each text block extracted by said text block extractor, evaluating validity of each text block based on a result of the character recognition, and selecting most valid text blocks from among the plurality of sets of text blocks.