Another solution to this problem is not as elegant as that of Nicholas Garfinkel, but much more simple, is as follows.
The fundamental problem with the code 128 is that it has a variable width. But in real life, we still use it as a fixed width. This requires an explanation. We place the code somewhere and expect that it will be wider than any, otherwise it will not fit, and we must reserve (left blank) space, which allowed him to fill. Thus, even if it is a variable width, we always need to select for it a fixed area on the label.
Thus, the solution to the problem of centering it would make the code 128 of fixed length.
If this is a subset of C (pairs of digits), you will need:
- Get any big enough number in the form of 100000 ... so that the total will be even.
- Add your code to it.
For example, if your code 94100101140001, you can add it with 10 ^ 16 and receive the following:
10000000000000000 94100101140001
Thus, the code becomes a fixed width and can be highly centered.
If your code is not a subset of C, and contains text, (in pseudo-code) you do:
my_code = "S/N:941001-0114-0001" const_max_code_length = 24 (for example) if my-code.length > const_max_code_length then error padding_char = "=" result = "" for (0..(const_max_code_length - my_code.length)) do result += padding_char end_for result += my_code " my_code = "S/N:941001-0114-0001" const_max_code_length = 24 (for example) if my-code.length > const_max_code_length then error padding_char = "=" result = "" for (0..(const_max_code_length - my_code.length)) do result += padding_char end_for result += my_code
In the case of your code, it will produce:
Then, no matter what text you insert into it, it will always have a fixed length and will therefore be placed in series.
I've used it myself, before I found this post. This is not good, this is a hack, and what Nicholas Garfinkel suggested is more correct. However, the best solution would be if he ZPL supported centering code, and, unfortunately, no.