infoxicator / react-native-star-prnt

React-Native bridge to communicate with Star Micronics Bluetooth/LAN Printers
MIT License
67 stars 65 forks source link

problem with appendBitmap (print from local storage) #72

Open joansolabasetis opened 3 years ago

joansolabasetis commented 3 years ago

Hi, I'm printing a ticket from my printer (sm-s230i) and everything works fine with the exception that I can't print an image from the local storage of my device. I use appendBitmap. My code is as follow:

const commandsArray = [];
  commandsArray.push({ appendCodePage: StarPRNT.CodePageType.CP858 });
  commandsArray.push({ appendEncoding: StarPRNT.Encoding.Windows1252 });
  commandsArray.push({ appendInternational: StarPRNT.InternationalType.Spain });
  commandsArray.push({ appendAlignment: StarPRNT.AlignmentPosition.Center });

  commandsArray.push({ appendLogo: 1 }); //printed
  commandsArray.push({ append: '\n\n' }); //printed
  commandsArray.push({ appendFontStyle: 'A' }); //printed
  commandsArray.push({ appendEmphasis: 'Firma Cliente\n\n' }); //printed
  uri= 'file:///storage/emulated/0/Pictures/imageBitmap.bmp'
  commandsArray.push({ appendBitmap: uri, width:30, height:30 }); //not printed

I've passed the uri without 'file://', and data image directly, among other solutions but nothing seems to be working.

Is there any possibility that this functionality is not compatible with this printer? Is there any error in my code?

Thank you