1. An image forming apparatus comprising: a conveyance unit configured to convey a recording medium; a processing unit configured to generate dot data for forming an image based on image information; an image forming unit configured to form an image on the recording medium conveyed by the conveyance unit based on the dot data generated by the processing unit; and a detection unit configured to detect a side end of the recording medium conveyed by the conveyance unit, wherein the processing unit enlarges an image of the acquired image information to a size protruding into margins formed at both side ends of the recording medium, then converts the image information into dot data, and then, based on a result of detection by the detection unit, processes the dot data so that image formation is not performed on portions of the enlarged image protruding into the margins.