androidreact-nativeexpozebra-printers

Direct print from React Native to Zebra ZQ520


I'm currently trying to print from my React Native app to a Zebra ZQ520 portable printer. I have been able to print using a 3rd party print service, but part of the problem is I also need this to direct print (silent print) as I want to avoid the Android print preview screen.

I'm using Expo for development so this adds another issue as a lot of the libraries cannot be used without first ejecting from Expo. This is something that I can do if need be, but right now I'm just trying to find the best solution to this problem.

So far I have printed through the 3rd party print service by calling Expo's Print.printAsync(options) and passing through HTML but again, this only serves to call the android print preview screen which I'm trying to avoid. I've also looked at PDF direct from Zebra (https://www.zebra.com/us/en/support-downloads/printer-software/pdf-virtual-device.html) which shows some promise as you can also use Expo's Print.printToFileAsync() to save to .PDF format. With this option I just currently haven't found if it's possible to use PDF direct from an Android device.

The thought I had with ejecting was using the react-native BLE PLX package (https://github.com/Polidea/react-native-ble-plx) to handle the direct connection with the Zebra printer and send raw CPCL commands to the printer. The issue this seemed to raise was the limitations in terms of any images that may need to be printed.

I'm very new to React and up until now I've never had to work with hardware either so I'm trying to learn as I go. If anyone can point me in the right direction it would be appreciated.


Solution

  • I found a solution a few months back and figured I should post the answer in case it helps someone else. The library mentioned above by anderwald I had actually checked out at one point, but it wasn't robust enough for my needs as I needed to direct print a .PDF

    I ended up dropping Expo and just converted my app to a pure react-native build and to handle the connection, I went with a service from these guys: https://mobiprintapp.com/

    This wasn't 100% ideal, as there was a small licensing cost required, however it was easy to integrate and did exactly what I needed it to do, so for me it was worth it.