drffej / webusb.printer

Webusb Thermal Printer demo
38 stars 22 forks source link

Unable to detect printer using webusb api #1

Open kundanscorpio opened 6 years ago

kundanscorpio commented 6 years ago

I am able to read data from bar code scanner using webusb api following the steps mentioned on url: https://developers.google.com/web/updates/2016/03/access-usb-devices-on-the-web However when I try to integrate a receipt printer (Model Epson: UB-U09) on same usb port using this file

File: printer.html

It opens with a pop-up saying no device-found. I am using following version of chrome on windows 10: Version 60.0.3112.113 (Official Build) (64-bit) I tried detecting the same device on windows 8 machine and I see following javascript error on console: Uncaught TypeError: Cannot read property 'requestDevice' of undefined at connectAndPrint (printer.html:30) at HTMLInputElement.onclick (printer.html:4) I have tried using both running the same code on http server as well as https but with no luck. The same port with same file printer.html detects my iPhone and shows as paired but does not detect the printer. When I click on Print I get a pop-up saying no devices found. Any help appreciated.

image

drffej commented 6 years ago

I expect this because Windows has claimed the device. Try uninstalling the driver and the latest version of chrome browser.

manishPatel1997 commented 5 months ago

navigator.usb.requestDevice({ filters: [{ vendorId: 0x1208 }] })

apply vendorid like :: 0x1208