Hello Daniweb.
I've been working on a small POS termal printer, and now i've run into a problem.
The problem is somewere deep down in the mystical depths of ESC commands.
However, to the point... I've printed a barcode (EAN13), The barcode comes out but there is a small problem with it. If the last digits is 0's then the printer removes them and replaces it with a apparently random number:

Here is an example:
the barcode contains:


However, the data it should contain is:


As you see the last digit is WRONG.

>   WRONG!  ^

And thats it.

Here is the code i use to generate the barcode with:

Const GS As Byte = &H1D
    Function ean13(ByVal word As String) As String
        Dim line as string = ""
        line &= Chr(GS) + "k" + Chr(67) + Chr(12) 'Same problem with chr(13) :(
        line &= word 'the data that the barcode should contain.
        line &= word 'and ofc the same data should be written below it.
        ean13 = line
    End Function

And here is the Printer model's programming manual:


Anyway to remove the faulty digit is acceptable

And Thank YOU for the help.

I checked EAN13 protocal. looks like you cannot have a number longer than 12.


    101 is your country code

    2290 is manufacture code

    90035 is the produce code 

    last digit 0 is being ignored and appended with the check digit 8, It is automatically appended by your barcode toolkits.

    Reference here http://www.barcodeisland.com/ean13.phtml

    I think you should not pass that 0 and also when you read,  and need to ignore last digit.

    I am not fimiliar with barcode reader, but in my memory, the Code3of9 also has check digits, but my company barcode reader automatically suppress the check digits number. Maybe you can have a look your barcode scanner setting.



Changed the Barcode typ to CODE128 with a length of 13. and it work just fine now.
too bad that ean13 had a check digit, otherwise it whould be perfect for the job.

For those who wonder about the code it is a small change:

line &= Chr(GS) + "k" + Chr(67) + Chr(12)


line &= Chr(GS) + "k" + Chr(73) + Chr(13)

 And that made my day Thank you, MiniMun_max

Solved Here : http://social.msdn.microsoft.com/Forums/en-US/vbgeneral/thread/1ba87d0a-c9f4-44df-be5b-8c3b9b18e8e3

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.