In order to detect a position of an optical recording medium on which
printing is performed, it is provided an optical sensor provided with
include a photo emitter operable to emit light and a photo receiver
operable to receive light and output a first signal in accordance with an
amount of the received light. The optical sensor is transported to a
position above a marker provided on the tray. Light is emitted from the
photo emitter to irradiate the marker. Light reflected from the marker is
received by the photo receiver. A reference value is determined based on
a first value of the first signal outputted when the marker is
irradiated. A predetermined calculation is executed with respect to the
reference value to determine a threshold value. The optical sensor is
transported above the tray, while emitting light from the photo emitter
and comparing the first signal outputted from the photo receiver with the
threshold value. A position of the marker is identified based on the
comparison of the first signal and the threshold value. It is determined
a position at which the printing begins based on the identified position
of the marker.