A printer device comprising a mechanism adapted to generate an image on an image surface, the device comprising a sensor adapted to image a predetermined optical object located substantially on the image surface, the device being adapted to determine at least one dimension of the object's image and thereby determine the distance separating the mechanism and the image surface.