Printer is GoojPRT portable printer PT-210 (thermal printer)
the same code is work on another thermal printer POS but not work on this printer for Arabic characters the English characters is good but the Arabic characters is shown as chinses characters
try to add encoded as charset " UTF-8 " and not working for Arabic characters the code for print :
Button btnPrint=(Button)findViewById(R.id.btnPrint);
btnPrint.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
Thread t = new Thread() {
public void run() {
try {
OutputStream os = mBluetoothSocket
.getOutputStream();
BILL = "ENGLISH" + "\n";
BILL = BILL + "العربية" + "\n";
BILL = BILL + "---------------" + "\n";
os.write(BILL.getBytes( ));
} catch (Exception e) {
}
}
};
t.start();
}
});
scan for printer:
Button btnScan = (Button) findViewById(R.id.btnScan);
btnScan.setOnClickListener(new View.OnClickListener() {
public void onClick(View mView) {
mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
if (mBluetoothAdapter == null) {
Toast.makeText(ActivityTest.this, "Error", Toast.LENGTH_SHORT).show();
} else {
if (!mBluetoothAdapter.isEnabled()) {
Intent enableBtIntent = new Intent(
BluetoothAdapter.ACTION_REQUEST_ENABLE);
startActivityForResult(enableBtIntent,
REQUEST_ENABLE_BT);
} else {
ListPairedDevices();
Intent connectIntent = new Intent(ActivityTest.this,
DeviceListActivity.class);
startActivityForResult(connectIntent,
REQUEST_CONNECT_DEVICE);
}
}
}
});
sample of printing
I need to print text not bitmap or image