tpcl(TEC打印机命令语言)[ESC] PC左对齐

时间:2014-08-13 15:43:19

标签: php printing thermal-printer printer-control-language

我想使用php和LPR向我的tec打印机发送标签。 一切都工作正常,除了一些部分的对齐。 我的代码/标签是:

{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|}

因此,[ESC] PC的手册说明了这一点:

可以在此处找到完整的手册(第50-56页的内容): Manual

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

...跳过第一部分......

J:角色归属

    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.)

...再次跳过......

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 

可以在此处找到完整的手册(第50-56页的内容): Manual

现在,毕竟那个文字。如何才能设置正确的文本?

作为奖励问题;)

我如何使用€(欧元)符号。

手册说使用B0H ..我试过,但还没有解决方案。

提前致谢!

3 个答案:

答案 0 :(得分:2)

我找到了答案..
只是需要学会阅读。

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

应该是

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

= 符号表示我们显示的字符串的起始位置最多为225位。

答案 1 :(得分:2)

正确地说明了具有特定对齐字段的命令

决赛结束后

Px (where x can be 1 = Left , 2 = center, 3 Right)" B"在" ="

之前

示例:

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

在这种情况下,坐标保持为"单词的中心" 请注意标签"左边的标签"由命令决定

{D0478,0600,0400,0640|}

在您的情况下,您告诉打印机标签宽度为40毫米。 由于中心校准,东芝打印机将打印头的左侧移动靠近标签的左侧,这要归功于" D"命令

答案 2 :(得分:2)

默认情况下,€(欧元)符号为B0H。 要设置€(欧元)符号,必须将B0H转换为十进制。 在这种情况下,B0H =(char)176 C#中的示例:

b[0]["Ben"] = 12
decimal price = 10.00;
SringBuilder sb = new StringBuilder();

现在,如果使用.Net和Socket发送命令,则必须在byte []中转换字符串,并且必须使用以下编码 Encoding.BigEndiangUnicode 。然后,例如:
sb.Add("{PC04;0465,0270,05,05,J,00,B=" + (char)176 + " " + price + "|}");
Socket c;
string str = "{PC04;0465,0270,05,05,J,00,B=" + (char)176 + " " + price + "|}";
byte[] buffer = System.Text.Encoding.BigEndianUnicode.GetBytes(str)

我希望我能说清楚。