How To Print British Pound Sign £ On Printer In Android Code
enter image description hereI want to print bill (payment-bill) but it does not display pound sign in receipt?Also i want to print chines character How to solve this problem,Please
Solution 1:
Solution 2:
First you have to initialize printer commands with this code.
finalbyte[] Init = {27, 29, 116, 32};//for star micronicsfinalbyte[] InitTM = {27, 116, 16};//for other printers.
Then you have to use windows 1252 encoding.
String commands = "£ 120";
byte[] b = newbyte[0];
try {
b = commands.getBytes("windows-1252");
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
Solution 3:
Try this,
publicclassExampleEuroPound {
publicstaticvoidmain(String args[]){
String euro = "\u20ac";
String pound = "\u00a3";
System.out.println("pound = " + pound);
System.out.println("euro = " + euro);
}
}
this may helps you.
More Unicode Characters : here
EDIT 1:
byte[] b = pound.getBytes(Charset.forName("UTF-8"));
byte[] b = pound.getBytes(StandardCharsets.UTF_8); // Java 7+ only
then add
list.add(pound);
EDIT2:
This should work.
String euro = "\u20ac";
String pound = "\u00a3";
List<String> list = new ArrayList<String>();
list.add(pound);
list.add(euro);
for(int i = 0 ;i < list.size(); i++){
System.out.println(list.get(i));
}
Post a Comment for "How To Print British Pound Sign £ On Printer In Android Code"