I want to set the position of the head of the printer through the ESC / pos:
ESC $ Set the absolute horizontal position
ESC $ nL nH
How do I calculate the nL
, nH
?
I want to set the position of the head of the printer through the ESC / pos:
ESC $ Set the absolute horizontal position
ESC $ nL nH
How do I calculate the nL
, nH
?
Here is excerpt from documentation for some printer like yours: "NAME: Set absolute print position FUNCTION: Sets the distance from the beginning of the line RANGE: 0 ≤ nL ≤ 255 0 ≤ nH ≤ 255 [Details] ·The distance from the beginning of the line to the print position is [(nL + nH x 256) x (horizontal motion unit)] inches.
nH - number of printing symbol positions from the begin of the line, nL - number of printing points from the begin of the line. And it seems that each symbol position conststs of 256 points.
So, nL is the remainder from disivion horizontal position by 256 and is used for "fine tuning" of horizontal position.
So, given head position offset from line begin (in inches) you get:
$nL = floor(($offsetFromLineBeginInInches/$horizontal_motion_unit) / 256);
$nH = ($offsetFromLineBeginInInches/$horizontal_motion_unit) % 256;
default horizontal motion unit you can look up in documentation for your specific printer