1. A method for determining a logical structure of a document, the method comprising: acquiring at least one image of pages of the document; identifying one or more blocks in the image of the document; generating at least one document hypothesis for the whole document; for each document hypothesis, verifying said document hypothesis on each page; correcting or discarding said document hypothesis in case of disconfirming said document hypothesis on the respective page; selecting programmatically as a best document hypothesis the document hypothesis that has a best degree of correspondence with one or more block hypotheses for the document on pages of the document; and forming a representation of the document based on the best document hypothesis.