One pair, one label
^XA takes no parameters at all: two characters and that is the whole command. The same goes for ^XZ. What they delimit is a complete label format, and the printer only starts drawing when it receives the ^XZ — until then it is accumulating instructions.
So a file with fifty ^XA…^XZ pairs is fifty labels, one after another. There is no “next label” command: the next ^XA is the next-label command.
- ^XA — opens the format. No parameters.
- ^XZ — closes the format and prints. No parameters.
- ^PQ — inside the pair, sets how many copies of that label to print.
- A missing final ^XZ still renders here, but a printer would sit waiting for it.
Why you got fewer pages than ^XA blocks
A block that draws nothing is printer housekeeping, not a label. ^XA^MCY^XZ clears the bitmap; ^XA^IDR:FILE.GRF^FS^XZ deletes a file from memory. Neither produces an image, and turning them into blank pages would make a fifty-label file into a hundred pages, half of them empty.
So those blocks are dropped on purpose. A block that tried to draw is kept even if it comes out blank — the distinction is whether it tried, not what it produced.
What usually comes right after ^XA
The commands that apply to the whole label sit at the top, because they affect everything after them: ^PW and ^LL set the size, ^CI28 sets the character encoding, ^LH moves the origin, ^BY sets the barcode defaults.
If accented characters are coming out wrong, this is where something is missing: a ^CI28 straight after ^XA fixes it, and placing it halfway down only affects the fields from there on.