Tico.13
Member
Hola a todos, alguien me podria ayudar a traducir a B4A este ejemplo que brinda TSC para imprimir desde android a impresoras TSC utilizando la libreria serial o la clase esc/pos:
Android Example for TSC Bluetooth
import com.example.tscdll.TSCActivity;
public class MainActivity extends Activity {
TSCActivity TscDll = new TSCActivity();
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
TscDll.openport("00:19:0E:A0:04:E1");
TscDll.downloadpcx("UL.PCX");
TscDll.downloadbmp("Triangle.bmp");
TscDll.downloadttf("ARIAL.TTF");
TscDll.setup(70, 110, 4, 4, 0, 0, 0);
TscDll.clearbuffer();
TscDll.sendcommand("SET TEAR ON\n");
TscDll.sendcommand("SET COUNTER @1 1\n");
TscDll.sendcommand("@1 = \"0001\"\n");
TscDll.sendcommand("TEXT 100,300,\"3\",0,1,1,@1\n");
TscDll.sendcommand("PUTPCX 100,300,\"UL.PCX\"\n");
TscDll.sendcommand("PUTBMP 100,520,\"Triangle.bmp\"\n");
TscDll.sendcommand("TEXT 100,760,\"ARIAL.TTF\",0,15,15,\"THIS IS ARIAL FONT\"\n");
TscDll.barcode(100, 100, "128", 100, 1, 0, 3, 3, "123456789");
TscDll.printerfont(100, 250, "3", 0, 1, 1, "987654321");
String status = TscDll.printerstatus();
text1.setText(status);
TscDll.printlabel(2, 1);
//TscDll.sendfile("zpl.txt");
TscDll.closeport(5000);
}
}
Android Example for TSC Bluetooth
import com.example.tscdll.TSCActivity;
public class MainActivity extends Activity {
TSCActivity TscDll = new TSCActivity();
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
TscDll.openport("00:19:0E:A0:04:E1");
TscDll.downloadpcx("UL.PCX");
TscDll.downloadbmp("Triangle.bmp");
TscDll.downloadttf("ARIAL.TTF");
TscDll.setup(70, 110, 4, 4, 0, 0, 0);
TscDll.clearbuffer();
TscDll.sendcommand("SET TEAR ON\n");
TscDll.sendcommand("SET COUNTER @1 1\n");
TscDll.sendcommand("@1 = \"0001\"\n");
TscDll.sendcommand("TEXT 100,300,\"3\",0,1,1,@1\n");
TscDll.sendcommand("PUTPCX 100,300,\"UL.PCX\"\n");
TscDll.sendcommand("PUTBMP 100,520,\"Triangle.bmp\"\n");
TscDll.sendcommand("TEXT 100,760,\"ARIAL.TTF\",0,15,15,\"THIS IS ARIAL FONT\"\n");
TscDll.barcode(100, 100, "128", 100, 1, 0, 3, 3, "123456789");
TscDll.printerfont(100, 250, "3", 0, 1, 1, "987654321");
String status = TscDll.printerstatus();
text1.setText(status);
TscDll.printlabel(2, 1);
//TscDll.sendfile("zpl.txt");
TscDll.closeport(5000);
}
}