The following is a Print Format to print labels use zpl that have individual serial numbers for each label.
I use it from Purchase receipts so that the labels can be printed upon receipt.
It will print directly to the printer (do not put raw printing on) but the output is fussy about which browser you use. SeaMonkey worked the best for me.
In the Print Format choose Custom Format - the following was used in the Purchase receipt doctype:
When you print the next screen will be as follows:
The resultant label will be: