Upon generating control codes to be output to a printing apparatus, an application designates the total number of control codes that can be generated, and when the designated number of control codes that can be generated has been exceeded, subsequent control codes are ceased to be generated, thus avoiding any memory errors and the like.