In this study, CAD/CAM system for a 5-axis printing machine was developed. The configuration of 5-axis printing machine is based on the 5-axis CNC milling machine; the spindle of the 5-axis CNC milling machine was replaced by a commercial printer. CAD software was first used to develop a three dimensional model, after that a color figure which will be printed on a freeform surface was applied on the surface of that three dimensional model. Then the printing paths of the 5-axis printing machine were generated by using mapping transformation. Furthermore, the distance between the print head and the curved printing surface is an important factor which affects the printing quality. It is also noted that any two points on the surface of the print head have different distances with the curved surface, it is necessary to keep these distances in a certain range of acceptable printing quality. Therefore, the range of good printing quality distance was measured. The height and width of the region which the print head print at one printing step were limited by the good printing quality distance. If the curvature of surface is too large (the distance between print head and curved surface is depend on the curvature of the surface), only the region which had good printing quality was printed. The unprinted area was printed after the print head rotated and translated to a proper position.