The aim of the present invention is to provide a projector device and a medical device with said projector device, said devices facilitating an improved projection of a two-dimensional pattern onto a plane in an optical body, in particular in an eye.For this purpose, the invention proposes a projector device for projecting a two-dimensional pattern on a plane in an optical body, in particular in an eye, with a light source which is designed to emit a light beam, with a deflecting device which is designed to deflect the light beam in order to generate the two-dimensional pattern, with an optical module which is arranged between the light source and the plane, and with a control device which is designed to control the deflecting device such that the two-dimensional pattern is formed on the plane, wherein the optical module has at least two regions with different focal lengths through which said light beam can be guided in an alternating or consecutive manner by means of the deflecting device, and wherein the control device is designed to control the deflecting device and the light source such that the light beam is guided through the at least two regions in order to compensate for position-resolved aberrations of the optical body and to project the two-dimensional pattern on the plane such that optical aberrations are corrected.