HP PCL/PJL reference (PCL 5 Printer Language) - Technical Reference Manual Part II

EN PE, Polyline Encoded 20-37
Encoding PE Flag Values and X,Y Coordinates
Flag values and X,Y coordinates are encoded into a base 64 (default)
or base 32 equivalent (7-bit mode).
The following steps give a generic algorithm for encoding a number.
Assume x is the number to be encoded. Use steps 1 and 2 only if
you are encoding fractional data; otherwise, begin with step 3.
Note When converting numbers to base 32 or 64 (step 4 in the following
instructions), note that highest order digits are always in the high
range, all other digits are in the low range. Therefore, if there is
only one digit in a number, it is in the high range.
Table 20-24 Procedure to encode a number
STEPS EXAMPLE
1. Fraction adjustment. If you are
using fractional data, this step converts
the number of decimal places in your
data to the number of binary fractional
bits. Assume "n" is the number of
fractional binary bits specified by the
fractional data flag.
x = 82.83
a. Multiply the number of decimal
places contained in the data by 3.33.
2 × 3.33 = 6.66
b. Round that number up to the next
integer to get integer n.
n = round (decimal places ×
3.33)
n = 7
x = x × 2
n
x = 82.83 × 2
7
=
10,525.42