Printed products can be efficiently sorted into non-defective ones and defective ones even when a discharge failure occurs during the printing operation. Two inspection patterns for detecting discharge failure are printed before and after a plurality of images. The inspection patterns are read to determine the type of discharge failure. Printed media are sorted based on whether it is determined that there is a continuous discharge failure, whether it is determined that there is an accidental discharge failure, or whether it is determined that the discharge is normal.