How to do HTML document printer job?

#1

hello, i am completely new to expo and create-react-native , is anybody know code for print a document from app, i just tried window.print() function , but it did’t work it shows “undefined is not function (evaluating ‘window.print()’)”.

#2

I have been working with React-native and Expo for a month already. Despite going through in various obstacles, I have been sticking with Expo. I like XDE, the development cycle, and most specially the promised Over-The-Air update. I am almost done with a full blown app that is capable downloading a product catalog and allows user to record sales in the App, along with graphs showing daily sales.

Now I am face with the challenge which requires me to print (receipt printer bluetooth, WIFI or USB regular printer. When I search for “Print” or “printer” in the forum, there are two topics found. One of them is this, which no one answered. I wish that I do not have eject to Expo Kit.

Any input or advise will be appreciated. Thanks in advanced.

#3

React Native does not have DOM elements so there is no web page, in a sense, to print. However if you only want to print HTML or a PDF from another source, this package may be helpful: react-native-print

#4

Hi Thanks for your reply. Are you using that react-native-print will work with Expo without detaching? I checked the package, it requires react-native link. So I assume that I need to detach.

#5

I am not using it. Unfortunately you will have to detach for anything that uses native modules or code. There is a feature request for it (https://expo.canny.io/feature-requests/p/printing-api) which you can vote on. It was started by an Expo team member so hopefully it will be implemented in the future

#6

Thanks for your advise. Meanwhile, I am detaching to Expo Kit.