An image forming device comprising: a transport unit that transports a recording medium in a transport direction; a printing unit that is disposed to face the transport unit and applies an ink to a printing surface of the transported recording medium to perform printing; a treatment unit (20, 60) that is disposed to face the transport unit and performs treatment on the transported recording medium; a movement unit that changes a distance between the printing unit and the treatment unit (20, 60) in the transport direction; an information acquisition unit that acquires at least one information of information on a transportation speed of the recording medium in the transport unit, information on an applied amount of the ink in the printing unit, or information on a surface state of the printing surface of the recording medium; and a distance control unit that controls the distance based on the acquired information, characterized in that an image is printed on the printing surface of the recording medium in advance before the printing by the printing unit and the treatment by the treatment unit (20, 60), the information acquisition unit acquires whether the image printed in advance is an electrophotographic picture or an image printed by using an energy ray curable ink, as the information on the surface state of the printing surface of the recording medium, and the distance control unit decreases the distance between the printing unit and the treatment unit (20, 60) in the transport direction in a case in which the image printed in advance is the electrophotographic picture or the image printed by using the energy ray curable ink. a transport unit that transports a recording medium in a transport direction; a printing unit that is disposed to face the transport unit and applies an ink to a printing surface of the transported recording medium to perform printing; a treatment unit (20, 60) that is disposed to face the transport unit and performs treatment on the transported recording medium; a movement unit that changes a distance between the printing unit and the treatment unit (20, 60) in the transport direction; an information acquisition unit that acquires at least one information of information on a transportation speed of the recording medium in the transport unit, information on an applied amount of the ink in the printing unit, or information on a surface state of the printing surface of the recording medium; and a distance control unit that controls the distance based on the acquired information, characterized in that an image is printed on the printing surface of the recording medium in advance before the printing by the printing unit and the treatment by the treatment unit (20, 60), the information acquisition unit acquires whether the image printed in advance is an electrophotographic picture or an image printed by using an energy ray curable ink, as the information on the surface state of the printing surface of the recording medium, and the distance control unit decreases the distance between the printing unit and the treatment unit (20, 60) in the transport direction in a case in which the image printed in advance is the electrophotographic picture or the image printed by using the energy ray curable ink.