thon-ju / bluetooth_print

a flutter plugin connect to bluetooth thermal printer support both Android and IOS (eg. Gprinter pt-380、gp-1324、gp-2120)
MIT License
149 stars 192 forks source link

I cant print image in IOS #128

Open ebapp-dev opened 1 year ago

ebapp-dev commented 1 year ago

I receive the following error:

call method -> printReceipt [Graphics] Invalid size provided to UIGraphicsBeginImageContext(): size={0, 0}, scale=1.000000

My code is:

                           ByteData data = await rootBundle
                                .load("assets/images/logo100.bmp");
                            List<int> imageBytes = data.buffer.asUint8List(
                                data.offsetInBytes, data.lengthInBytes);
                            String base64Image = base64Encode(imageBytes);
                            list.add(LineText(
                                width: 100,
                                type: LineText.TYPE_IMAGE,
                                content: base64Image,
                                align: LineText.ALIGN_CENTER,
                                linefeed: 1));

                            await bluetoothPrint.printReceipt(config, list);

This code is OK in Android.

YouSour commented 1 year ago

+1 i got the same problem.

thaisimey commented 1 year ago

I got the same problem

masreplay commented 1 year ago

@ebapp-dev @thaisimey @xni06 any update?

YouSour commented 1 year ago

i recommend this package https://pub.dev/packages/flutter_bluetooth_printer after no reply or solution.

ebapp-dev commented 1 year ago

@ebapp-dev @thaisimey @xni06 any update?

I decided to change the project and gave up on this solution.

masreplay commented 1 year ago

I wrote the entire thing from scratch :)

HamzaMihfad commented 1 year ago

I have the same problem, is there any solution?!

amer-zk commented 8 months ago

This PR will solve the problem : https://github.com/thon-ju/bluetooth_print/pull/181/files

HamzaMihfad commented 7 months ago

@amer-zk can you explain please how to use this? https://github.com/thon-ju/bluetooth_print/pull/181/files I'm trying to use it but I have no idea how to replate the package with this link

this is my current code (pubspec.yaml file): bluetooth_print: git: url: https://github.com/Osama0habib/bluetooth_print.git

this is the error: Could not build the precompiled application for the device. ARC Semantic Issue (Xcode): No visible @interface for 'EscCommand' declares the selector 'addOriginrastBitImage:width:height:' /Users/hamzamihfad/.pub-cache/git/bluetooth_print-0c19226c0d912afa919a48bf8f5aede901712121/ios/Classes/BluetoothPrintPlugin.m:240:21