Reputation: 671
I would like to print characters like č, ć, š to be precise Croatian characters. I am using Bixolon sdk for SPP-R200II printer. The code is very simple for now, just want to print some string
ListaRacuna.mBixolonPrinter.printText(slanjeNaPrinter, BixolonPrinter.ALIGNMENT_LEFT, 0, BixolonPrinter.TEXT_SIZE_HORIZONTAL1 | BixolonPrinter.TEXT_SIZE_VERTICAL1, false);
ListaRacuna.mBixolonPrinter.lineFeed(1, false);
ListaRacuna.mBixolonPrinter.cutPaper(true);
with connection to the printer via bluetooth.
Upvotes: 2
Views: 2732
Reputation: 11
CODE_PAGE_858_EURO
is okay for Spanish characters, but not for Eastern European ČŠŽĐ
.
The proposed solution is not working for me properly. After a lot of searching, I have come up with a solution.
Set code page that suport Slavic characters:
xx.mBixolonPrinter.setSingleByteFont(BixolonPrinter.CODE_PAGE_852_LATIN2);
Use a function to covert Slavic characters to something bixolon spp r400
will understand understand:
xx.mBixolonPrinter.printDotMatrixText(SloConvText, alignment, attribute, size, false);
where SloConvText
is:
SloConvText = ReplaceSloChar(s_textLine,ConvString);
And the key solution, ReplaceSloChar
(without \u0003
is not okay, uses two bytes instead, both Korean signs)
public static String ReplaceSloChar(String inString, String ConvString) {
String S1 = inString.replaceAll("Č","\u010C\u0003");
String S2 = S1.replaceAll("Š","\u0160\u0003");
String S3 = S2.replaceAll("Ž","\u017D\u0003");
String S4 = S3.replaceAll("č","\u010D\u0003");
String S5 = S4.replaceAll("š","\u0161\u0003");
ConvString = S5.replaceAll("ž","\u017E\u0003");
return ConvString;
}
It is overhead, but sending čšž
in any form to bixolon spp r400
is not working at all.
Upvotes: 1
Reputation: 12171
We had the same issue with the Spanish characters (ñ, á, é, €...) and contacted the Bixolon support e-mail. They answered us with a simple solution, and it worked: when you get the bixolonPrinter
object, make this before printing the text:
bixolonPrinter.setSingleByteFont(BixolonPrinter.CODE_PAGE_858_EURO);
You'll probably need to change the CODE_PAGE_*
constant to another one related with the chars you're trying to print.
BTW, it could be interesting to check this Open Source project, where we showcase how to print with the Bixolon printers and implement an autoconnection mechanism: Fewlaps loves Bixolon
Upvotes: 4