tr3v3r / react-native-esc-pos-printer

An unofficial React Native library for printing on an EPSON TM printer with the Epson ePOS SDK for iOS and Epson ePOS SDK for Android
MIT License
164 stars 71 forks source link

TM-m30II-NT usb Base64 image @ IOS - NSInvalidArgumentException #111

Closed 592da closed 1 month ago

592da commented 1 year ago

Hello!

I am trying to send the printer an image via USB.

I get the following error:

NSInvalidArgumentException: *** -[NSURL URLByAppendingPathComponent:]: component, components, or pathExtension cannot be nil.

device properly discovered and initialized

{
printer: {
bt: , 
ip: , 
mac: , 
name: TM-m30II-NT, 
target: USB:583939500274300000, 
usb: 583939500274300000
}
}

but once I sent the printing commands:

printing
        .initialize()
        .align("center")
        .newline()
        .image({ uri: image }, { width: this.options.adapter.escWidth })
        .newline()
        .cut()
        .send();

I get the error above

I checked i am sending a proper base64 string like in the example and the docs "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAjoA ... " (189512 length)

I tried also to pass a temporary file as URL for URI / require it but it didn't worked because cannot transform requires on runtime

any suggestions?

working with iPad Air 5gen ios 16.5

Thanks!!

hangkimduyen commented 1 year ago

how can you connect with epson via usb? my ipad have problem can not connect with epson via usb, the discover printer function return empty list printers. Can you show me how you do?

ahmad71666 commented 9 months ago

@tr3v3r do you have any soloution for that, Facing this issue too base64 not printing on IOS..

tr3v3r commented 9 months ago

@ahmad71666 It works for me. Please try to run this project and check if it works or not.

https://github.com/tr3v3r/react-native-esc-pos-printer/tree/main/example

If it's not please add more details here. lib version, logs, device, rn version and etc.