A control section sets the transfer bias level applied between a transfer roller and a photosensitive drum in the printer to a “ghost generation level.” The control section forms a test pattern on the recording medium by applying a transfer bias set to the ghost generation level in order to transfer a toner image onto the recording medium. A density sensor detects the density of the toner image deposited in a non-image-forming region when the test pattern is formed. The control section estimates a transfer bias level, at which ghosts will not occur, based on the ghost generation level and the density level of the toner image in the non-image-forming region, and sets this estimated value as the transfer bias level for forming images.