1. A method implemented in a data processing system for processing a hardcopy document, the hardcopy document having been printed by a printer based on a original image, the original image being a binary digital image, comprising: (a) generating a grayscale scanned image from the hardcopy document using an imaging device; (b) obtaining the original image; (c) dividing the original image into a plurality of original sub-images; (d) for each original sub-image, (d1) using template matching to find a scanned sub-image in the scanned image corresponding to the original sub-image; (d2) obtaining an initial threshold for binarizing the scanned sub-image; and (d3) obtaining an optimal threshold for binarizing the scanned sub-image using the initial threshold and an iterative search, and binarizing the scanned sub-image using the optimal threshold to generate an optimum binarized scanned sub-image that minimizes a measure of difference between the original sub-image and the binarized scanned sub-image; and (e) generating a binarized scanned image by combining the optimum binarized scanned sub-images generated in step (d).