Detecting paper size from USB printer

Is there any way to detect the paper size from a USB printer in QNX
6.2.1? I’m writing an application that needs to support printing on
letter and A4 paper, but the printer I’m using won’t print anything if
the size of the image I send to it is different from the paper size.