A medium processing apparatus comprising: a medium conveying passage along which a card-shaped recording medium having a magnetic stripe is conveyed; a first magnetic head (24; 26; 28) which faces the medium conveying passage from one side in a thickness direction of the recording medium passing through the medium conveying passage; a second magnetic head (25; 27; 29) which faces the medium conveying passage from the other side in the thickness direction of the recording medium; a first thermal head which faces the medium conveying passage from one side in the thickness direction of the recording medium; a second thermal head which faces the medium conveying passage from the other side in the thickness direction of the recording medium; characterized by a first moving mechanism which moves the first thermal head between a first contact position where the first thermal head is capable of contacting with the recording medium and a first retreated position where the first thermal head is retreated in a direction separated from the medium conveying passage; a second moving mechanism which moves the second thermal head between a second contact position where the second thermal head is capable of contacting with the recording medium and a second retreated position where the second thermal head is retreated in a direction separated from the medium conveying passage; and a control section for controlling the first thermal head, the second thermal head, the first moving mechanism and the second moving mechanism; wherein the control section determines whether the first magnetic head (24; 26; 28) has read magnetic data or the second magnetic head (25; 27; 29) has read magnetic data and, based on the determined result, the control section operates the first moving mechanism or the second moving mechanism to arrange the first thermal head to the first contact position or to arrange the second thermal head to the second contact position, and wherein the control section determines whether the recording medium is taken into the medium conveying passage from one end side of the recording medium or from the other end side based on a reading result of magnetic data by the first magnetic head (24; 26; 28) or the second magnetic head (25; 27; 29) and, based on the determined result, the control section prints on the recording medium by using the first thermal head or the second thermal head while performing temperature control of the first thermal head or the second thermal head and performing conveyance control of the recording medium. a medium conveying passage along which a card-shaped recording medium having a magnetic stripe is conveyed; a first magnetic head (24; 26; 28) which faces the medium conveying passage from one side in a thickness direction of the recording medium passing through the medium conveying passage; a second magnetic head (25; 27; 29) which faces the medium conveying passage from the other side in the thickness direction of the recording medium; a first thermal head which faces the medium conveying passage from one side in the thickness direction of the recording medium; a second thermal head which faces the medium conveying passage from the other side in the thickness direction of the recording medium; characterized by a first moving mechanism which moves the first thermal head between a first contact position where the first thermal head is capable of contacting with the recording medium and a first retreated position where the first thermal head is retreated in a direction separated from the medium conveying passage; a second moving mechanism which moves the second thermal head between a second contact position where the second thermal head is capable of contacting with the recording medium and a second retreated position where the second thermal head is retreated in a direction separated from the medium conveying passage; and a control section for controlling the first thermal head, the second thermal head, the first moving mechanism and the second moving mechanism; wherein the control section determines whether the first magnetic head (24; 26; 28) has read magnetic data or the second magnetic head (25; 27; 29) has read magnetic data and, based on the determined result, the control section operates the first moving mechanism or the second moving mechanism to arrange the first thermal head to the first contact position or to arrange the second thermal head to the second contact position, and wherein the control section determines whether the recording medium is taken into the medium conveying passage from one end side of the recording medium or from the other end side based on a reading result of magnetic data by the first magnetic head (24; 26; 28) or the second magnetic head (25; 27; 29) and, based on the determined result, the control section prints on the recording medium by using the first thermal head or the second thermal head while performing temperature control of the first thermal head or the second thermal head and performing conveyance control of the recording medium.