HeligPfleigh / react-native-thermal-receipt-printer

A RN library for thermal printer
169 stars 103 forks source link

How to print QrCode in BLEPrinter !!!! #165

Open aasuparekh1 opened 9 months ago

aasuparekh1 commented 9 months ago

Hello , how i can use this library for print a qrcode too , need some help . this one looks great if u guys have some way to print qrcode a i'll be very grateful

const [printers, setPrinters] = useState([]); const [currentPrinter, setCurrentPrinter] = useState();

useEffect(() => { BLEPrinter.init().then(()=> { BLEPrinter.getDeviceList().then(setPrinters); }); }, []);

_connectPrinter => (printer) => { //connect printer BLEPrinter.connectPrinter(printer.inner_mac_address).then( setCurrentPrinter, error => console.warn(error)) }

printTextTest = () => { currentPrinter && USBPrinter.printText("sample text\n"); }

printBillTest = () => { currentPrinter && USBPrinter.printBill("sample bill"); }

...

return (

{ this.state.printers.map(printer => ( _connectPrinter(printer)}> {`device_name: ${printer.device_name}, inner_mac_address: ${printer.inner_mac_address}`} )) } Print Text Print Bill Text

)

licomobrusli commented 9 months ago

Seems not. I am trying out this repo instead -- https://github.com/pajkho/react-native-thermal-receipt-printer-image-qr/tree/main/example -- works pretty well but requires legacy peer deps, so needs to be updated. Can print images and QRs.

bhargavpmistri commented 8 months ago

you can use it in latest repo, just have to update method in node-modules after install it