Question

I'm using EPL to print directly barcode from a Zebra printer (LP 2844 to be more specific). The problem I'm having is that I can't control the physical length of the barcode.

For example, these 2 lines of code will print 2 barcodes with different length even though the narrow bar width, wide bar width and the length of the contents are set to be the same.

B134,308,0,1,4,12,160,B,"00G38EX"
B136,540,0,1,4,12,160,B,"0086150" 

I know that the input content is what matters here but I can't just figure out how it works. Is there any way to set the length of the barcode to be fixed or at least make it controllable ie: given a known input content, I know what I should expect the physical length would be.

Was it helpful?

Solution

You're correct - it's data-sensitive.

Code 128 has 3 sub-alphabets. Set "A" contains all ASCII the control codes, digits, many symbols and UPPER-CASE letters (00H..5FH). Set "B" contains the 'printables` (symbols, digits, both-case letters - 20H..7FH). Code "C" contains digit-pairs (00..99).

The start-code selects the alphabet to be used, and the set-in-use may be switched by inserting a START-A, START-B or START-C as appropriate.

Sadly, the firmware does not allow the code to be forced (according to the documentation) and the shortest-possible barcode is printed by analysing the string to be printed.

So - in your case, the codes should be START-A/0/0/G/3/8/E/X/STOP = 7 data elements START-C/00/86/15/START-A/0/STOP = 5 data elements

The code will never be longer than the first, nor shorter than the second for 7-character data (let's not get into the possibility of control-characters...)

Which one would be selected depends on the individual sequence to be printed. I'm sure it could be worked out - a sequence of two digits costs 1 extra element but saves 1; of 4 digits costs 1 but saves 2 - IF the sequence is at one end of the string or the other.

Best to program for the longest-possible (all-alphas) and accept the compression as a bonus.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top