Click here to Skip to main content
15,891,184 members

Comments by Member 4773987 (Top 4 by date)

Member 4773987 25-May-20 11:51am View    
I checked all details, everything is fine, the tablet which connect to printer does not return any error and does not print
Member 4773987 23-May-20 17:31pm View    
The below code build without any errors, also i did all configuration successful,

While run the application in mobile does not connect to printer it is return erros, fine.

But when i run it in the connected Tablet with the same network with Epson Tm-M30 printer it is not print and no error appear. Please i need help why it is not print?

enter code here

final Context sContext = this;
Printer printer = null;
try {
printer = new Printer(Printer.TM_M30, Printer.MODEL_ANK, this);
}
catch (Epos2Exception e) {
//Displays error messages
Toast.makeText(sContext, "Error1", Toast.LENGTH_SHORT).show();
}

//new
final Context mContext = this;
printer.setReceiveEventListener(new ReceiveListener() {
@Override
public void onPtrReceive(Printer printer, int code, PrinterStatusInfo printerStatusInfo,
String s) {
if (code == com.epson.epos2.Epos2CallbackCode.CODE_SUCCESS){

}else{
Toast.makeText(mContext, "Printer can't be connected. Please try again",
Toast.LENGTH_SHORT).show();
}
}
});

try {
printer.addTextAlign(Printer.ALIGN_CENTER);
printer.addText("Hello World");
}
catch (Epos2Exception e) {
Toast.makeText(mContext, "Can't print Hello World. Please try again",
Toast.LENGTH_SHORT).show();
}

try {
printer.connect("TCP:192.168.100.21", Printer.PARAM_DEFAULT);
}
catch (Epos2Exception e) {
Toast.makeText(mContext, "Error1", Toast.LENGTH_SHORT).show();
}

try {
printer.sendData(Printer.PARAM_DEFAULT);
}
catch (Epos2Exception e) {
Toast.makeText(mContext, "Error2", Toast.LENGTH_SHORT).show();
// Abort process
}
//public void onPtrReceive(final Printer printerObj, final int code, final PrinterStatusInfo
status,
//final String printJobId) {
ReceiveListener printrecieve_listener = new ReceiveListener() {
@Override
public void onPtrReceive(final Printer printerObj, final int code, PrinterStatusInfo
printerStatusInfo, String printJobId) {
runOnUiThread(new Runnable() {
@Override
public synchronized void run() {
if (code == com.epson.epos2.Epos2CallbackCode.CODE_SUCCESS) {

} else {
Toast.makeText(mContext, "Error3", Toast.LENGTH_SHORT).show();

}
}
});
new Thread(new Runnable() {
@Override
public synchronized void run() {

}
}).start();
Member 4773987 20-May-20 10:30am View    
I need to print pdf file direct to printer, i don’t know how?
Member 4773987 24-Feb-20 14:52pm View    
Sorry, confused