Unsure it is possible to read label size from printer, but you can try to use SGD "odometer.label_dot_length" command from Programming Guide document.
Software Engineer, Kutir Mobility
Posted on behalf of Zebra Technologies
The label size involves the width and length of a label. The length of a label can be detected through the media calibration. The width of the label is predetermined through the type of printers and width of the media, for example, 2" printer vs 4" printer. The calibration process doesn't auto detect the width of a label. Once the media in the printer has been calibrated, the program can query the length of the label
! U1 getvar "zpl.label_length"
Please note, printers accepts the media that is narrower than the printer width.