INFO: Use left margin command to keep 2D barcode aligned


When printing 2D barcodes using a PCL font, you need to keep all lines started from the same X position. There are several cursor movement commands, however note that the carriage return will move the cursor back to the leftmost of the paper. There are several solutions.

Left Margin Command

The PCL "Left Margin Command" is considered the best solution. With this command, you set all remaining printing to begin at X location. After the barcode is printed, you can reset the left margin to 0.

In the example below, <esc>&a10L sets left margin to the width of 10 text characters. Command <esc>9 resets the left margin back after the barcode is printed.

<esc>& (8U<esc>& (s1p8v4699T 
F4DDBE3C374B3EC75CA5  printing barcode

Cursor Movement Command

You can also call cursor movement commands to move the cursor. However, because carriage return resets the cursor position to the left margin, you must call movement command for every line of text.

In the example below, <esc>&a720H moves the cursor 1 inch right to the left margin (720 decimal points).