andrey-ushakov / esc_pos_printer Goto Github PK
View Code? Open in Web Editor NEWESC/POS (thermal, receipt) printing for Flutter & Dart
License: BSD 3-Clause "New" or "Revised" License
ESC/POS (thermal, receipt) printing for Flutter & Dart
License: BSD 3-Clause "New" or "Revised" License
这个插件可以打印pdf格式的文件吗?
Hi @andrey-ushakov thank you a lot for your hardwork. Is it possible to print content in landscape view.
Refer sample below :
Uint8List bytes = Uint8List.fromList(list).buffer.asUint8List();
final Image image1 = decodeImage(bytes);
printer.printImage(image1);
Error:
NoSuchMethodError: The getter 'width' was called on null.
Es necesario tener dos proyectos para poder implementar esta libreia, o solo con tener uno es mas que suficiente.
Hi theres, i used your library but i get a problem. I used printer canon to test print first. But when i used it print one paper per println. Am I wrong in any settings ?
testPrint(String printerIp, BuildContext ctx) {
Printer.connect(printerIp,
port: int.parse(portController.text), timeout: Duration(seconds: 5))
.then((printer) async {
printer.println(
'Print text example 1 Print text example 2 Print text example 3 Print text example 4 Print text example 5 Print text example 6 Print text example 7');
printer.println('Example', styles: PosStyles(bold: true));
printer.cut();
printer.disconnect();
});
}
I hope there is support Bluetooth for android.
Hi, i'm trying to print greek characters, using the "PosCodeTable.greek" option but i'm getting the following error:
E/flutter (19694): [ERROR:flutter/lib/ui/ui_dart_state.cc(154)] Unhandled Exception: Invalid argument (string): Contains invalid characters.: "αβγδώ"
E/flutter (19694): #0 _UnicodeSubsetEncoder.convert (dart:convert/ascii.dart:86:9)
E/flutter (19694): #1 Latin1Codec.encode (dart:convert/latin1.dart:40:46)
E/flutter (19694): #2 Printer._print (package:esc_pos_printer/src/printer.dart:109:26)
E/flutter (19694): #3 Printer.println (package:esc_pos_printer/src/printer.dart:130:5)
E/flutter (19694): #4 _MyHomePageState._print. (package:print_app/main.dart:33:15)
E/flutter (19694): #5 _rootRunUnary (dart:async/zone.dart:1132:38)
E/flutter (19694): #6 _CustomZone.runUnary (dart:async/zone.dart:1029:19)
E/flutter (19694): #7 _FutureListener.handleValue (dart:async/future_impl.dart:126:18)
E/flutter (19694): #8 Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:639:45)
E/flutter (19694): #9 Future._propagateToListeners (dart:async/future_impl.dart:668:32)
E/flutter (19694): #10 Future._completeWithValue (dart:async/future_impl.dart:483:5)
E/flutter (19694): #11 Future._asyncComplete. (dart:async/future_impl.dart:513:7)
E/flutter (19694): #12 _rootRun (dart:async/zone.dart:1124:13)
E/flutter (19694): #13 _CustomZone.run (dart:async/zone.dart:1021:19)
E/flutter (19694): #14 _CustomZone.runGuarded (dart:async/zone.dart:923:7)
E/flutter (19694): #15 _CustomZone.bindCallbackGuarded. (dart:async/zone.dart:963:23)
E/flutter (19694): #16 _microtaskLoop (dart:async/schedule_microtask.dart:41:21)
E/flutter (19694): #17 _startMicrotaskLoop (dart:async/schedule_microtask.dart:50:5)
My print code is:
printer.println('αβγδώ', styles: PosStyles(codeTable: PosCodeTable.greek));
For class Ticket there is no method to stop printer. What can i do to finish printing.
Thanks.
How to config charset UTF-8 (Thai) please ?
Please help me to setup bluetooth connection
Hi @andrey-ushakov,
First of all, thanks for making this plugin. this is really useful.
I have a question about this plugin.
When i print a simple text, there's always an added '00' text in front of the text that i wanted to print. Example:
Can you help me on this? because i really have no idea.
Thanks.
Here is the code that i use to print the above image:
` Printer.connect(prefs.getString('printer-ip-1'), port: 9100).then((printer) {
printer.println('This is a test print');
printer.println('Special 1: àÀ èÈ éÉ ûÛ üÜ çÇ ôÔ',
styles: PosStyles(codeTable: PosCodeTable.westEur));
printer.println('Special 2: blåbærgrød',
styles: PosStyles(codeTable: PosCodeTable.westEur));
printer.println('Bold text', styles: PosStyles(bold: true));
printer.println('Reverse text', styles: PosStyles(reverse: true));
printer.println('Underlined text',
styles: PosStyles(underline: true), linesAfter: 1);
printer.println('Align left', styles: PosStyles(align: PosTextAlign.left));
printer.println('Align center',
styles: PosStyles(align: PosTextAlign.center));
printer.println('Align right',
styles: PosStyles(align: PosTextAlign.right), linesAfter: 1);
printer.printRow([
PosColumn(
text: 'col3',
width: 3,
styles: PosStyles(align: PosTextAlign.center, underline: true),
),
PosColumn(
text: 'col6',
width: 6,
styles: PosStyles(align: PosTextAlign.center, underline: true),
),
PosColumn(
text: 'col3',
width: 3,
styles: PosStyles(align: PosTextAlign.center, underline: true),
),
]);
printer.println('Text size 200%',
styles: PosStyles(
height: PosTextSize.size2,
width: PosTextSize.size2,
));
printer.cut();
printer.disconnect();
});`
printer.println('中文字');
printerManager.scanResults.listen((devices) async {
print(devices);
setState(() {
_devices = devices;
});
});
D/ViewRootImpl@4ead107MainActivity: ViewPostIme pointer 0
D/ViewRootImpl@4ead107MainActivity: ViewPostIme pointer 1
I/flutter (19001): []
D/BluetoothBasicPlugin(19001): start scan
I/flutter (19001): []
D/BluetoothAdapter(19001): STATE_ON
I/flutter (19001): []
D/BluetoothAdapter(19001): STATE_ON
D/BluetoothAdapter(19001): STATE_ON
D/BluetoothAdapter(19001): BLE support array set: 010011
D/BluetoothLeScanner(19001): Start Scan with callback
D/BluetoothLeScanner(19001): onScannerRegistered() - status=0 scannerId=7 mScannerId=0
D/BluetoothAdapter(19001): STATE_ON
D/BluetoothAdapter(19001): STATE_ON
D/BluetoothLeScanner(19001): Stop Scan with callback
Could you help ?
Many people are using android phones to print receipt.
Hi,
Thank you for this amazing library firstly, secondly I am going to pull it tomorrow as I would like to add the usb printing facility.
Given that it is your work, do you have any guidance?
I was looking at using https://pub.dev/packages/usb_serial, then sending the same commands over the usb serial port? are there any specifics that you are aware of that we should take into consideration.
Once we have it working, we will give it right back to you :)
Tried with evolute prime ESC Bluetooth thermal printer. My printer not listing in scanned Bluetooth device list.
Is this package support above mentioned printer ? Please provide some supporting printer list.
in my case it doesn't seem to pass this point:
checks for state 1 or 0 here:
_bluetoothManager.state.listen((state) async {
switch (state) {
case BluetoothManager.CONNECTED:
// To avoid double call
if (!_isConnected) {
await _bluetoothManager.writeData(bytes);
completer.complete(PosPrintResult.success);
}
// TODO sending disconnect signal should be event-based
_runDelayed(3).then((dynamic v) async {
await _bluetoothManager.disconnect();
_isPrinting = false;
});
_isConnected = true;
break;
case BluetoothManager.DISCONNECTED:
_isConnected = false;
break;
default:
break;
}
});
but the actual state is 10 - 13 here:
private void state(Result result){
try {
switch(mBluetoothAdapter.getState()) {
case BluetoothAdapter.STATE_OFF:
result.success(BluetoothAdapter.STATE_OFF); <------ 10
break;
case BluetoothAdapter.STATE_ON: <------- 12
result.success(BluetoothAdapter.STATE_ON);
break;
case BluetoothAdapter.STATE_TURNING_OFF: <---- 13
result.success(BluetoothAdapter.STATE_TURNING_OFF);
break;
case BluetoothAdapter.STATE_TURNING_ON: <----- 11
result.success(BluetoothAdapter.STATE_TURNING_ON);
break;
default:
result.success(0);
break;
}
} catch (SecurityException e) {
result.error("invalid_argument", "Argument 'address' not found", null);
}
}
this doesn't seem specific to my printer
can support bluetooth printer?
Pls implement Bluetooth support
How do you do.
Hi! I can't print cyrilic symbols
it's code
final Ticket ticket = Ticket(PaperSize.mm80); ticket.text('ЙЦУКЕНГШЩЗХЪХЭЖДЛОРПАВЫФЯЧСМИТЬБЮ.', styles: PosStyles( codeTable: PosCodeTable.pc866, fontType: PosFontType.fontA, )); ticket.cut(); return ticket;
it's exception
E/flutter ( 8146): #6 _MyHomePageState.build.<anonymous closure>.<anonymous closure> package:blue/main.dart:148 E/flutter ( 8146): #7 _InkResponseState._handleTap package:flutter/…/material/ink_well.dart:706 E/flutter ( 8146): #8 _InkResponseState.build.<anonymous closure> package:flutter/…/material/ink_well.dart:789 E/flutter ( 8146): #9 GestureRecognizer.invokeCallback package:flutter/…/gestures/recognizer.dart:182 E/flutter ( 8146): #10 TapGestureRecognizer.handleTapUp package:flutter/…/gestures/tap.dart:486 E/flutter ( 8146): #11 BaseTapGestureRecognizer._checkUp package:flutter/…/gestures/tap.dart:264 E/flutter ( 8146): #12 BaseTapGestureRecognizer.acceptGesture package:flutter/…/gestures/tap.dart:236 E/flutter ( 8146): #13 GestureArenaManager.sweep package:flutter/…/gestures/arena.dart:156 E/flutter ( 8146): #14 GestureBinding.handleEvent package:flutter/…/gestures/binding.dart:222 E/flutter ( 8146): #15 GestureBinding.dispatchEvent package:flutter/…/gestures/binding.dart:198 E/flutter ( 8146): #16 GestureBinding._handlePointerEvent package:flutter/…/gestures/binding.dart:156 E/flutter ( 8146): #17 GestureBinding._flushPointerEventQueue package:flutter/…/gestures/binding.dart:102 E/flutter ( 8146): #18 GestureBinding._handlePointerDataPacket package:flutter/…/gestures/binding.dart:86 E/flutter ( 8146): #19 _rootRunUnary (dart:async/zone.dart:1138:13) E/flutter ( 8146): #20 _CustomZone.runUnary (dart:async/zone.dart:1031:19) E/flutter ( 8146): #21 _CustomZone.runUnaryGuarded (dart:async/zone.dart:933:7) E/flutter ( 8146): #22 _invoke1 (dart:ui/hooks.dart:273:10) E/flutter ( 8146): #23 _dispatchPointerDataPacket (dart:ui/hooks.dart:182:5)
Can you help me with this?
Is it possible to align barcode to center ?
Hi,
I have a question regarding the speed of printing. When there are a lot of ticket "rows" and "texts" split into multiple lines in the code, the printer throttles, stoping every "rows" and "text" command due to the nature of sending bytes through the network(?). Whereas, if it's sent by 1 large ticket text command, the printer prints at a speed by manufacturer print speed (for this case 200mm/s).
Is this a limitation of ESC/POS commands by the network? or is there any way to improve this speed from this library?
Thanks!
can support bluetooth?
Can you please help with likely ESC/POS (usually thermal) network printers?
I am kind of confused searching to buy any workable printer for test.
Thanks in anticipation.
Cheers
Possibility of setting the margin before printing the bar code or allowing left, center or right alignment.
Thank you for your development.
Simplified Chinese used in China,Taiwan is called Traditional Chinese,cKanji is only available in Japan and South Korea.
I see the Chinese encoding is gbk_codec,but lost big5(Taiwan) code,
could you add ?
https://github.com/douasin/big5-dart
big5.encode('輕舟已過萬重山');
gbk.encode('轻舟已过万重山');
Is possible print barcode code128?
I am using a BTP-R880NP Network Receipt Printer to print:
Bag of Cherries......1....3.99....3.99
Drink................1...14.95...14.99
Basically, I'm trying to align each column to their own alignment. (1) align: left, (2) align: center, (3) align: right, (4) align: right. But instead they are all aligning to what i set for the first column. They are all aligning to the left.
My code:
printer.printRow([
PosColumn(
text: 'Bag of Cherries', // Drink
width: 6,
styles: PosStyles(
align: PosTextAlign.left,
),
),
PosColumn(
text: '1', // 1
width: 1,
styles: PosStyles(
align: PosTextAlign.center,
),
),
PosColumn(
text:
'3.99', // 14.95
width: 2,
styles: PosStyles(
align: PosTextAlign.right,
),
),
PosColumn(
text:
'3.99', //14.95
width: 3,
styles: PosStyles(
align: PosTextAlign.right,
),
),
]);
Printer.connect('192.168.1.87', port: 9100).then((printer) {
printer.println(
'Regular:Welcome Cambodia');
printer.println('Special 1: ខ្ញុំស្រលាញ់កម្ពុជា ',
styles: PosStyles(codeTable: PosCodeTable.pc850));
printer.println('Special 2: blåbærgrød',
styles: PosStyles(codeTable: PosCodeTable.westEur));
Because esc_pos_printer >=2.0.0 depends on rxdart >=0.23.0-dev.1 which requires SDK version >=2.6.0 <3.0.0, esc_pos_printer >=2.0.0 is forbidden.
So, because siyou depends on esc_pos_printer ^2.0.0, version solving failed.
So I've tried printing the example from the latin1 codec (since this plugin is already using it), which is: 'blåbærgrød'.
So: printer.println('blåbærgrød', styles: PosStyles(codeTable: PosCodeTable.pc865));
Setting the code table doesn't seem to help, no matter which code table is chosen.
It fails printing æ ø å, which is wierd since it's literally that example they show inside the latin1 codec.
Any idea if this project will support Flutter web?
thanks,
After print page show error "Unknow Error: -2"
Error Log:
D/BluetoothBasicPlugin(31951): start scan D/BluetoothAdapter(31951): STATE_ON D/BluetoothLeScanner(31951): onClientRegistered() - status=0 clientIf=5 mClientIf=0 D/BluetoothAdapter(31951): STATE_ON I/flutter (31951): UI: Devices found Instance of 'Future<int>' D/BluetoothAdapter(31951): STATE_ON D/BluetoothLeScanner(31951): could not find callback wrapper D/BluetoothSocket(31951): try to open PaxInternalPrinter D/BluetoothSocket(31951): =====[tangkw]:to connect BT_Printer... W/BluetoothAdapter(31951): getBluetoothService() called with no BluetoothManagerCallback D/BThermalPrinterPlugin(31951): android.bluetooth.device.action.ACL_CONNECTED D/BluetoothBasicPlugin(31951): stateStreamHandler, current action: android.bluetooth.device.action.ACL_CONNECTED E/DeviceConnFactoryManager(31951): wait read D/BluetoothSocket(31951): write PaxInternalPrinter:�@�a0�E0�V0�B0�-0�M0�!��$���.Regular: aA bB cC dD eE fF gG hH iI jJ kK lL mM nN oO pP qQ rR sS tT uU vV wW xX yY zZ D/BluetoothSocket(31951): �@�a0�E0�V0�B0�-0�M0�!��$���.�t�Special 1: 嗬 枞 樯 缜 粼 D/BluetoothSocket(31951): �@�a0�E0�V0�B0�-0�M0�!��$���.�t�Special 2: bl錬鎟gr鴇 D/BluetoothSocket(31951): �@�a0�E1�V0�B0�-0�M0�!��$���.Bold text D/BluetoothSocket(31951): �@�a0�E0�V0�B1�-0�M0�!��$���.Reverse text D/BluetoothSocket(31951): �@�a0�E0�V0�B0�-1�M0�!��$���.Underlined text D/BluetoothSocket(31951): D/BluetoothSocket(31951): �@�a0�E0�V0�B0�-0�M0�!��$���.Align left D/BluetoothSocket(31951): �@�a1�E0�V0�B0�-0�M0�!��$���.Align center D/BluetoothSocket(31951): �@�a2�E0�V0�B0�-0�M0�!��$���.Align right D/BluetoothSocket(31951): D/BluetoothSocket(31951): �@�a0�E0�V0�B0�-0�M0�!��$���.Text size 200% D/BluetoothSocket(31951): �@ D/BluetoothSocket(31951): write PaxInternalPrinter:��� D/BluetoothSocket(31951): write PaxInternalPrinter:�h W/System.err(31951): java.io.IOException: bt socket closed, read return: -1 W/System.err(31951): at android.bluetooth.BluetoothSocket.read(BluetoothSocket.java:630) W/System.err(31951): at android.bluetooth.BluetoothInputStream.read(BluetoothInputStream.java:96) W/System.err(31951): at java.io.InputStream.read(InputStream.java:101) W/System.err(31951): at com.gprinter.io.BluetoothPort.readData(BluetoothPort.java:130) W/System.err(31951): at com.tablemi.flutter_bluetooth_basic.DeviceConnFactoryManager.readDataImmediately(DeviceConnFactoryManager.java:418) W/System.err(31951): at com.tablemi.flutter_bluetooth_basic.DeviceConnFactoryManager$PrinterReader.run(DeviceConnFactoryManager.java:498) E/BluetoothPort(31951): connection device is lost E/DeviceConnFactoryManager(31951): read 0 W/BluetoothAdapter(31951): getBluetoothService() called with no BluetoothManagerCallback D/BThermalPrinterPlugin(31951): android.bluetooth.device.action.ACL_DISCONNECTED D/BluetoothBasicPlugin(31951): stateStreamHandler, current action: android.bluetooth.device.action.ACL_DISCONNECTED
App crashes after clicking on searching bluetooth devices by the way the app working fine with android
xcode output :
2020-03-04 17:44:40.310095+0100 Runner[94466:2281835] call method -> startScan
2020-03-04 17:44:40.310386+0100 Runner[94466:2281835] getDevices method -> startScan
2020-03-04 17:44:40.312031+0100 Runner[94466:2281835] *** Assertion failure in -[CBCentralManager initWithDelegate:queue:options:], /BuildRoot/Library/Caches/com.apple.xbs/Sources/MobileBluetoothFramework_Sim/MobileBluetooth-132.8/CoreBluetooth/CoreBluetooth/CBCentralManager.m:230
2020-03-04 17:44:40.326653+0100 Runner[94466:2281835] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'State restoration of CBCentralManager is only allowed for applications that have specified the "bluetooth-central" background mode'
*** First throw call stack:
(
0 CoreFoundation 0x000000011345d27e __exceptionPreprocess + 350
1 libobjc.A.dylib 0x0000000113251b20 objc_exception_throw + 48
2 CoreFoundation 0x000000011345cff8 +[NSException raise:format:arguments:] + 88
3 Foundation 0x0000000112c79b51 -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 191
4 CoreBluetooth 0x00000001132ae101 -[CBCentralManager initWithDelegate:queue:options:] + 910
5 Runner 0x000000010f47ef0a -[BLEConnecter initParament] + 292
6 Runner 0x000000010f47eddc -[BLEConnecter init] + 66
7 Runner 0x000000010f48a85d -[ConnecterManager initConnecter:] + 61
8 Runner 0x000000010f48a7ee -[ConnecterManager didUpdateState:] + 94
9 Runner 0x000000010f486aae -[BluetoothPrintPlugin handleMethodCall:result:] + 1486
10 Flutter 0x00000001101ecdb5 Flutter + 581045
11 Flutter 0x0000000110180ba0 Flutter + 138144
12 Flutter 0x000000011018464e Flutter + 153166
13 Flutter 0x00000001101e6969 Flutter + 555369
14 Flutter 0x0000000110193b73 Flutter + 215923
15 Flutter 0x00000001101988b8 Flutter + 235704
16 CoreFoundation 0x00000001133c0b94 __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ + 20
17 CoreFoundation 0x00000001133c0882 __CFRunLoopDoTimer + 1026
18 CoreFoundation 0x00000001133bfeda __CFRunLoopDoTimers + 266
19 CoreFoundation 0x00000001133bac4e __CFRunLoopRun + 2238
20 CoreFoundation 0x00000001133ba066 CFRunLoopRunSpecific + 438
21 GraphicsServices 0x0000000116a22bb0 GSEventRunModal + 65
22 UIKitCore 0x000000011d667d4d UIApplicationMain + 1621
23 Runner 0x000000010f47df50 main + 112
24 libdyld.dylib 0x00000001141bcc25 start + 1
25 ??? 0x0000000000000001 0x0 + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
I used your package to print, almost everything works fine but one thing that I can't complete which is: when I print my invoice image, the result of printer just take only half of paper width, it didn't take the full width of paper.
Hello! Im trying to print with barcode, in this case ean13, and all the tests i have the error:
Someone know what i can do? I think is a bug..
D/BluetoothBasicPlugin( 1358): start scan
D/BluetoothAdapter( 1358): STATE_ON
D/BluetoothLeScanner( 1358): onClientRegistered() - status=0 clientIf=5 mClientIf=0
D/BluetoothAdapter( 1358): STATE_ON
I/flutter ( 1358): UI: Devices found Instance of 'Future'
D/BluetoothAdapter( 1358): STATE_ON
D/BluetoothLeScanner( 1358): could not find callback wrapper
D/BluetoothSocket( 1358): try to open PaxInternalPrinter
D/BluetoothSocket( 1358): =====[tangkw]:to connect BT_Printer...
W/BluetoothAdapter( 1358): getBluetoothService() called with no BluetoothManagerCallback
D/BThermalPrinterPlugin( 1358): android.bluetooth.device.action.ACL_CONNECTED
D/BluetoothBasicPlugin( 1358): stateStreamHandler, current action: android.bluetooth.device.action.ACL_CONNECTED
E/DeviceConnFactoryManager( 1358): wait read
D/BluetoothSocket( 1358): write PaxInternalPrinter:�@�a1�E1�V0�B0�-1�M0�!p�$���.Demo text
D/BluetoothSocket( 1358): �@
D/BluetoothSocket( 1358): �E0�V0�B0�-1�M0�!��$���.Item �E0�V0�B0�-1�M0�!��$>��.Price
D/BluetoothSocket( 1358): �@�.�H��.�k�1234567890423��d�
D/BluetoothSocket( 1358):
D/BluetoothSocket( 1358):
D/BluetoothSocket( 1358):
D/BluetoothSocket( 1358):
D/BluetoothSocket( 1358): �V0
D/BluetoothSocket( 1358): write PaxInternalPrinter:���
W/System.err( 1358): java.io.IOException: bt socket closed, read return: -1
W/System.err( 1358): at android.bluetooth.BluetoothSocket.read(BluetoothSocket.java:630)
W/System.err( 1358): at android.bluetooth.BluetoothInputStream.read(BluetoothInputStream.java:96)
W/System.err( 1358): at java.io.InputStream.read(InputStream.java:101)
W/System.err( 1358): at com.gprinter.io.BluetoothPort.readData(BluetoothPort.java:130)
W/System.err( 1358): at com.tablemi.flutter_bluetooth_basic.DeviceConnFactoryManager.readDataImmediately(DeviceConnFactoryManager.java:418)
W/System.err( 1358): at com.tablemi.flutter_bluetooth_basic.DeviceConnFactoryManager$PrinterReader.run(DeviceConnFactoryManager.java:498)
E/BluetoothPort( 1358): connection device is lost
E/DeviceConnFactoryManager( 1358): read 0
W/BluetoothAdapter( 1358): getBluetoothService() called with no BluetoothManagerCallback
D/BThermalPrinterPlugin( 1358): android.bluetooth.device.action.ACL_DISCONNECTED
D/BluetoothBasicPlugin( 1358): stateStreamHandler, current action: android.bluetooth.device.action.ACL_DISCONNECTED
E/BluetoothSocket( 1358): java.lang.Throwable
E/BluetoothSocket( 1358): at android.bluetooth.BluetoothSocket.write(BluetoothSocket.java:650)
E/BluetoothSocket( 1358): at android.bluetooth.BluetoothOutputStream.write(BluetoothOutputStream.java:85)
E/BluetoothSocket( 1358): at com.gprinter.io.BluetoothPort.writeDataImmediately(BluetoothPort.java:113)
E/BluetoothSocket( 1358): at com.tablemi.flutter_bluetooth_basic.DeviceConnFactoryManager.sendDataImmediately(DeviceConnFactoryManager.java:386)
E/BluetoothSocket( 1358): at com.tablemi.flutter_bluetooth_basic.DeviceConnFactoryManager$1$1.run(DeviceConnFactoryManager.java:475)
E/BluetoothSocket( 1358): at java.lang.Thread.run(Thread.java:761)
E/BluetoothSocket( 1358): at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:428)
E/BluetoothSocket( 1358): at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:278)
E/BluetoothSocket( 1358): at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:273)
E/BluetoothSocket( 1358): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133)
E/BluetoothSocket( 1358): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607)
E/BluetoothSocket( 1358): at java.lang.Thread.run(Thread.java:761)
W/System.err( 1358): java.lang.NullPointerException: Attempt to invoke virtual method 'void java.io.OutputStream.flush()' on a null object reference
D/DeviceConnFactoryManager( 1358): abnormal disconnection
W/System.err( 1358): at com.gprinter.io.BluetoothPort.writeDataImmediately(BluetoothPort.java:114)
W/System.err( 1358): at com.tablemi.flutter_bluetooth_basic.DeviceConnFactoryManager.sendDataImmediately(DeviceConnFactoryManager.java:386)
W/System.err( 1358): at com.tablemi.flutter_bluetooth_basic.DeviceConnFactoryManager$1$1.run(DeviceConnFactoryManager.java:475)
W/System.err( 1358): at java.lang.Thread.run(Thread.java:761)
W/System.err( 1358): at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:428)
W/System.err( 1358): at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:278)
W/System.err( 1358): at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:273)
W/System.err( 1358): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133)
W/System.err( 1358): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607)
W/System.err( 1358): at java.lang.Thread.run(Thread.java:761)
how can i get this to work with a bluetooth thermal printer?
I have a printer that connects to a router through an ethernet cable and my device connects through WIFI to this router.
If a ping in the command prompt the ip and port of the printer it responds back and when I'm using the library the library can connect successfully. But it does nothing when I write the printing lines of code. I'm using the same example from the repository I only copy pasted into a new flutter project.
This is the flutter doctor response:
[√] Flutter (Channel stable, v1.12.13+hotfix.5, on Microsoft Windows [Version 10.0.18362.535], locale en-US)
• Flutter version 1.12.13+hotfix.5 at C:\flutter
• Framework revision 27321ebbad (7 days ago), 2019-12-10 18:15:01 -0800
• Engine revision 2994f7e1e6
• Dart version 2.7.0
[√] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
• Android SDK at C:\Users\MUY Android\AppData\Local\Android\sdk
• Android NDK location not configured (optional; useful for native profiling support)
• Platform android-29, build-tools 29.0.2
• Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
• Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b03)
• All Android licenses accepted.
[√] Android Studio (version 3.5)
• Android Studio at C:\Program Files\Android\Android Studio
• Flutter plugin version 42.1.1
• Dart plugin version 191.8593
• Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b03)
[!] VS Code (version 1.39.2)
• VS Code at C:\Users\MUY Android\AppData\Local\Programs\Microsoft VS Code
X Flutter extension not installed; install from
https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter
[√] Connected device (2 available)
• Lenovo TB X104F • HA109XF6 • android-arm • Android 8.1.0 (API 27)
• Android SDK built for x86 • emulator-5554 • android-x86 • Android 10 (API 29) (emulator)
! Doctor found issues in 1 category.
Any help would be appreciated.
thanks for your hardwork, Is it possible to align image ?
Hi,
I see the 'Print Barcode' in the todo list. How soon that can we expect that'll be done?
Thanks;
Related to #17
The exact same issue, but i can't find your proposed solution (delete some lines in your library).
I am lsing Epson TM-U220B by the way.
Great job so far, appreciate any feedback @andrey-ushakov.
The hostname has been hardcoded in the example where we require to know the IP address in advance, is there not a way to discover Existing printers and then connect with the device to execute the print commands?
Also is there not a method to detect ESC/POS printers with USB/Bluetooth?
How can print Arabic words?
@andrey-ushakov I have notice in this line
https://github.com/andrey-ushakov/esc_pos_printer/blob/master/example/example.dart#L63
Image printing is comment out. Why?
Is this package does not support image printing anymore?
Hi,
After I update plugin to latest version, I faced this issue, even the example app results in the same, all text are printed as reverse text (black background and "white" font), tried in two diferent printers, and one of them, beyond that, the printer shutdown in middle of printing. (Maybe an issue with temperature, idk).
Any one face this issue?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.