1. A method for detecting the alignment of document in an automatic document feeder, comprising the steps of: Step A: providing an optical scanner having an automatic document feeder and a document, the automatic document feeder having a colored pattern layer in corresponding to a scanning window of the optical scanner, the document has at least one side edge, and when the document is fed into the automatic document feeder, the side edge is just located between the scanning window and the colored pattern layer; Step B: actuating the automatic document feeder to feed in the document, a first image retrieval is made for the document placed on the scanning window; Step C: an appropriate length of the document is fed in; Step D: a second image retrieval is made for the document placed on the scanning window; and Step E: a slant value is calculated out from the result of comparing the first image retrieval and the second image retrieval.