Bram Hammer
Bram Hammer

Reputation: 388

tpcl(TEC Printer Command Language) [ESC]PC align left

I want to send a label to my tec printer using php and LPR. Everything is working fine, except the alignment of some parts. My code/label as is:

{D0478,0600,0400,0640|}
{C|}
    {PC01;0040,0135,05,05,J,00,B=Item number: xxxxxx|}
    {PC02;0040,0170,05,05,I,00,B= Brand Model ExtraInfo|}
    {PC03;0040,0205,05,05,I,00,B=Optional Second Line|}
    {PC04;0465,0270,05,05,J,00,B=Eurosign?? Price|}
    {PC04;0380,0315,05,05,I,00,B=excl. btw (vat)|}
{XS;I,0001,0002C6101|}

So the manual of the [ESC]PC says this:

Full manual can be find here (content on page 50-56): Manual

[ESC] PCaaa; bbbb, cccc, d, e, ff (,ghh), ii, j (, Jkkll) (, Mm) (, noooooooooo)(, Zpp) (, Pq)(=rrr------rrr) [LF] [NUL]

...Skipping first part...

J: Character attribution

    B: Black character
    W (aabb): Reverse character
       aa: No. of dots from the character string to the end 
           of the black background in the horizontal direction
       bb: No. of dots from the character string to the end 
           of the black background in the vertical direction
              aa: 01 to 99 (in units of dots)
              bb: 01 to 99 (in units of dots)
    F (aabb): Boxed character
       aa: No. of dots from the character string area to 
           the box in the horizontal direction
       bb: No. of dots from the character string area to
           the box in the vertical direction
               aa: 01 to 99 (in units of dots)
               bb: 01 to 99 (in units of dots)
    C (aa): Stroked out character
        aa: No. of dots from the character string area to
            the end of the stroke
        aa: 01 to 99 (in units of dots)
    * Descriptions in parentheses are omissible.
    (If omitted, it is character magnification (horizontal or 
    vertical magnifications, whichever is larger) × 6 dots.)

...Again skipping...

Pq: Alignment

(Omissible, When omitted, the alignment is set to left.)
    q: Designates the character position
        1: Left
        2: Center
        3: Right
        4aaaa: Justification
            aaaa: Character string area of X direction
                  0050 to 1040 (in 0.1 mm units)
        5aaaabbbcc: Automatic line feed
            aaaa: Character string area of X direction
                  0050 to 1040 (in 0.1 mm units)
            bbb: Line feed spacing
                 010 to 500 (in 1 mm units)
            cc: Number of lines
                01 to 99
rrr------rrr: Data string to be printed (Omissible)
              Max. 255 digits 

Full manual can be find here (content on page 50-56): Manual

Now, after all that text. How can i manage to align the text right?

And as a bonus question ;)

How can i use an €(euro) sign.

The manual says to use B0H.. I tried, but no solution yet.

Thanks in advance!

Upvotes: 4

Views: 11674

Answers (3)

GioLomba
GioLomba

Reputation: 41

By default, the €(euro) sign is B0H. For setting the €(euro) sign, you must convert B0H in decimal. In this case B0H = (char)176.
Example in C#:

decimal price = 10.00;
SringBuilder sb = new StringBuilder();
sb.Add("{PC04;0465,0270,05,05,J,00,B=" + (char)176 + " " + price + "|}");

Now, if you use .Net and an Socket for send the command, then you must convert the string in byte[] and you must use the following encoding Encoding.BigEndiangUnicode. Then, for example:
Socket c;
string str = "{PC04;0465,0270,05,05,J,00,B=" + (char)176 + " " + price + "|}";
byte[] buffer = System.Text.Encoding.BigEndianUnicode.GetBytes(str)
c.Send(buffer);

I hope I made myself clear.

Upvotes: 4

Stefano
Stefano

Reputation: 21

the command to have a particular alignment of the filed is, as correctly told,

Px (where x can be 1 = Left , 2 = center, 3 Right) after the final "B" and before the "="

Example:

{PC01;0040,0135,05,05,J,00,B**,P2**=Item number: xxxxxx|}

In that case the coordinate are kept as "center of the word" keep care that the "left of label" is decided from the command

{D0478,0600,0400,0640|}

In your case you are telling to the printer that the label is 40mm wide. Toshiba printers, due the center alignment, move the left side of the printhead close to the left side of the label thanks to the "D" command

Upvotes: 2

Bram Hammer
Bram Hammer

Reputation: 388

I found the answer..
Just need t learn to read.

{PC04;0465,0270,05,05,J,00,B=Eurosign?? Price|}

Should be

{PC04;0465,0270,05,05,J,00,B,P3=Eurosign?? Price|}

The = sign means starting of the string to we shown with a max of 225 digits.

Upvotes: 2

Related Questions