oolio-group / xml-escpos-helper

Apache License 2.0
30 stars 13 forks source link

Print Image Example not working on React Native #20

Open rafaelnco opened 2 years ago

rafaelnco commented 2 years ago

hello guys! i am using the latest version of your library, could get everything to work BUT the image printing, which is exiting with an error: [Error: unrecognised content at end of stream

could you please help me with this? i think it is something related to running node libs to make pngjs work?

package.json:

  "dependencies": {
    "react": "~16.11.0",
    "react-native": "~0.62.2",
    "@tillpos/xml-escpos-helper": "^0.2.3",
    "node-libs-react-native": "^1.2.1",

metro.config.js:

module.exports = {
  resolver: {
    extraNodeModules: {
      ...require('node-libs-react-native'),
    }
  },
};

template and base64 image content exactly as following example https://github.com/hitz-group/xml-escpos-helper/blob/master/examples/src/printImage.ts

Amigs commented 2 years ago

hi In the dependency pngjs it is throwing the following error, that dependency is for images so maybe it will produce yours. https://github.com/lukeapage/pngjs/issues/290

rafaelnco commented 2 years ago

hey @Amigs ! thank you for your feedback! i remember having this problem a couple times but dont remember how exactly it stopped happening, really sorry for this, i am trying to remember something i did for it to work so i could share in this thread

but my feedback for now is that i have been able to use your lib and it is perfect, resolved my issue elegantly i really appreciate your work,