An electronic pen for interacting with a substrate having coded data disposed thereon. The pen includes: an image sensor for sensing the coded data when the pen is used to interact with the surface; a cartridge having a nib for contacting the surface; a retraction mechanism for slidably moving the cartridge between a retracted position and an extended position; a force sensor cooperating with the retraction mechanism; and a processor configured to generate indicating data indicative of the interaction with the substrate. The image sensor is configured to sense the coded data only when the force sensor detects that the nib is in contact with the substrate.