A printer, comprising: a printing device that prints on a surface of a printing medium; a transport device (18, 111) that transports the printing medium; a control portion that controls the transporting of the printing medium by the transport device and the printing by the printing device, based on detection of a mark that is printed in advance on a reverse face of the printing medium; an optical sensor that outputs a specified output value, based on light that is reflected from the reverse face of the printing medium; a width information storage portion that stores width information that indicates a width of the mark in the transport direction of the printing medium; a threshold value setting portion that sets a first threshold value for making a determination, based on the width information that is stored in the width information storage portion, as to whether the mark has been detected; a first determination portion that determines whether a first detection object color has been detected, based on the output value from the optical sensor; a first declaration portion that, in a case where the number of times that the first determination portion has consecutively determined that the first detection object color has been detected is not less than the first threshold value, declares that the first detection object color is continuous over a specified width in the transport direction of the printing medium; a second determination portion that determines whether a second detection object color that is different from the first detection object color has been detected, based on the output value from the optical sensor; and a second declaration portion that declares that the mark has been detected in a case where, after the first declaration portion has declared that the first detection object color is continuous over the specified width in the transport direction of the printing medium, the number of times that the second determination portion has consecutively determined that the second detection object color has been detected is not less than a specified second threshold value. a printing device that prints on a surface of a printing medium; a transport device (18, 111) that transports the printing medium; a control portion that controls the transporting of the printing medium by the transport device and the printing by the printing device, based on detection of a mark that is printed in advance on a reverse face of the printing medium; an optical sensor that outputs a specified output value, based on light that is reflected from the reverse face of the printing medium; a width information storage portion that stores width information that indicates a width of the mark in the transport direction of the printing medium; a threshold value setting portion that sets a first threshold value for making a determination, based on the width information that is stored in the width information storage portion, as to whether the mark has been detected; a first determination portion that determines whether a first detection object color has been detected, based on the output value from the optical sensor; a first declaration portion that, in a case where the number of times that the first determination portion has consecutively determined that the first detection object color has been detected is not less than the first threshold value, declares that the first detection object color is continuous over a specified width in the transport direction of the printing medium; a second determination portion that determines whether a second detection object color that is different from the first detection object color has been detected, based on the output value from the optical sensor; and a second declaration portion that declares that the mark has been detected in a case where, after the first declaration portion has declared that the first detection object color is continuous over the specified width in the transport direction of the printing medium, the number of times that the second determination portion has consecutively determined that the second detection object color has been detected is not less than a specified second threshold value.