The printers are ESC/POS compatible, but the characters are "cut out" in all the codepages and there are no characters from other languages.
I made a question to the manufacturer and he has indicated that I must use the graphic mode to get these characters to print.
Can anyone explain to me how to do this?
Thank you very much.
Well, here is the proof you have indicated.
You see lowercase accented vowels and the euro symbol.
The accented uppercase vowels and the ñÑ are not there.
This was my thinking too, except that I was sending the ESC t n command directly. I'd found ESC/POS documentation that indicated n = 14 was Windows 1252, but after you tried that and it didn't work, I searched a bit harder and I've found other documentation that indicates n is different for different printers, ie there is no standard. Also, n = 14 is often not listed, which would make our test result of "nothing changed" entirely plausible.
So let's try n = 0 to 20:
B4X:
Dim TestString As String
For I = 1 to 42 'so that fits on one printer line
TestString = TestString & Chr(128 + I * 3)
Next
For n = 0 to 20
SendToPrinter(Chr(27) & "t" & Chr(n)) 'ESC/POS command to select character code table n
SendToPrinter(n & ": " & TestString & Chr(13) & Chr(10))
Next
I think also that rendering to the printer's relatively-coarse resolution isn't going to be as nice as the printer's built-in (and hopefully custom-tuned) bitmap fonts.
Another option is to define characters that I don't need to print what I need, basically only: € ñ Ñ
The accented letters I can omit them, for the moment.
But does anyone have a link on how to define characters?
Using custom-defined characters sounds like an excellent backup plan. But it looks like usually the custom-definitions are stored separately to the built-in fonts, and you'd have to switch back-and-forth between the between the normal font and your custom font, eg this comment:
It's a bit complicated to define whole code page while we need to override only 2 symbols. So we decided to turn on user-defined characters (ESC % 1) before printing special symbols, and turn off (ESC % 0) after that. Not graceful, but easier to implement.
Dim TestString As String
For I = 1 to 42 'so that fits on one printer line
TestString = TestString & Chr(128 + I * 3)
Next
For n = 0 to 20
SendToPrinter(Chr(27) & "t" & Chr(n)) 'ESC/POS command to select character code table n
SendToPrinter(n & ": " & TestString & Chr(13) & Chr(10))
Next
But why do they do that? I don't understand.
I mean, you can choose any international configuration to print labels, but not tickets.
It doesn't make any sense.
Is it possible that the method you're using to send characters to the printer, is somehow stripping out the ESC/POS commands?
What happens with:
B4X:
Sub TestPrint(CmdNum As Int, CmdDesc As String)
Dim OutString As String = CmdDesc
If CmdNum <> 0 Then
OutString = Chr(27) & Chr(CmdNum) & "1" & OutString & Chr(27) & Chr(CmdNum) & "0"
End If
OutString = OutString & Chr(13) & Chr(10)
SendToPrinter(OutString)
End Sub
TestPrint(0, "Normal")
TestPrint(45, "Underline")
TestPrint(52, "Italics")
TestPrint(69, "Emphasis")
TestPrint(66, "Reverse")
I agree it is not clear ? and it would certainly help if they clarified whether "labels" means physical sticky paper labels, or GUI labels on the screen.
So maybe they're saying that text printing can only be done in ASCII/English but if you print a GUI label via snapshot and image print, then you can print any characters that the GUI can render (to the label on the screen).
I agree it is not clear ? and it would certainly help if they clarified whether "labels" means physical sticky paper labels, or GUI labels on the screen.
So maybe they're saying that text printing can only be done in ASCII/English but if you print a GUI label via snapshot and image print, then you can print any characters that the GUI can render (to the label on the screen).
I just heard back from the manufacturer and it says this:
But why do they do that? I don't understand.
I mean, you can choose any international configuration to print labels, but not tickets.
It doesn't make any sense.
I think this is a hardware limitation. The build-in chip or firmware may have limited ROM. If the printer support more commands then the manufacturer may need to use more expensive chip or different chip supplied from the other vendor. Just my 2 cents.
This is the test program I am using. It is Agraham's bluetooth print esc/pos class.
Those 3 characters are "&&&" and yet they come out different on the printer.
B4X:
Dim ESC As String = Chr(27)
Dim FS As String = Chr(28)
Dim GS As String = Chr(29)
'Bold and underline don't work well in reversed text
Dim UNREVERSE As String = GS & "B" & Chr(0)
Dim REVERSE As String = GS & "B" & Chr(1)
' Character orientation. Print upside down from right margin
Dim UNINVERT As String = ESC & "{0"
Dim INVERT As String = ESC & "{1"
' Character rotation clockwise. Not much use without also reversing the printed character sequence
Dim UNROTATE As String = ESC & "V0"
Dim ROTATE As String = ESC & "V1"
' Horizontal tab
Dim HT As String = Chr(9)
' Character underline
Dim ULINE0 As String = ESC & "-0"
Dim ULINE1 As String = ESC & "-1"
Dim ULINE2 As String = ESC & "-2"
' Character emphasis
Dim BOLD As String = ESC & "E1"
Dim NOBOLD As String = ESC & "E0"
' Character height and width
Dim SINGLE As String = GS & "!" & Chr(0x00)
Dim HIGH As String = GS & "!" & Chr(0x01)
Dim WIDE As String = GS & "!" & Chr(0x10)
Dim HIGHWIDE As String = GS & "!" & Chr(0x11)
Could you give this a burl? It uses .WriteBytes so that we hopefully know precisely what bytes are being sent to the printer, rather than .WriteString which I think is doing some code page translations.
B4X:
Dim TestBytes(42) As Byte
For I = 1 to 42 'so that fits on one printer line
TestBytes(I - 1) = 32 + I * 5
Next
For n = 0 to 20
Dim CommandBytes(3) As Byte = Array As Byte(27, 116, n) 'ESC t n
Printer1.WriteBytes(CommandBytes)
Dim HeadingString As String = n & ": "
For I = 0 To HeadingString.Length - 1
Printer1.WriteBytes(Array As Byte(Asc(HeadingString.CharAt(I))))
Next I
Dim NewLineBytes(2) As Byte = Array As Byte(13, 10)
Printer1.WriteBytes(NewLineBytes)
Next
Lol... close but no cigar. Sorry. Probably work better if we print the 42 test characters too, by adding the highlighted line:
B4X:
Dim TestBytes(42) As Byte
For I = 1 to 42 'so that fits on one printer line
TestBytes(I - 1) = 32 + I * 5
Next
For n = 0 to 20
Dim CommandBytes(3) As Byte = Array As Byte(27, 116, n) 'ESC t n
Printer1.WriteBytes(CommandBytes)
Dim HeadingString As String = n & ": "
For I = 0 To HeadingString.Length - 1
Printer1.WriteBytes(Array As Byte(Asc(HeadingString.CharAt(I))))
Next I
Printer1.WriteBytes(TestBytes)
Dim NewLineBytes(2) As Byte = Array As Byte(13, 10)
Printer1.WriteBytes(NewLineBytes)
Next