In an ink jet printer using an ink cartridge having an ink tank for
storing ink therein and a recording head for ejecting the ink stored in
the ink tank as ink drops and forming an image on a recording paper
sheet, the detection accuracy of a displacement detection sensor for
detecting a displacement of printing position is improved while reducing
manufacturing costs of the displacement detection sensor. The
displacement detection sensor is comprised of a light emitting device for
emitting diffused light, a first lens for focusing the light emitted from
the light emitting device on a recording paper sheet, a second lens for
focusing the light reflected by the recording paper sheet and a light
receiving device for receiving the light focused by the second lens. By
focusing the diffused light emitted from the light emitting device by the
first lens, the diameter of a beam spot projected on the recording paper
sheet is made smaller than a longitudinal dimension and a width dimension
of each component forming a displacement detection pattern.