cordova-plugin-printer icon indicating copy to clipboard operation
cordova-plugin-printer copied to clipboard

pick method returns null

Open mjirian opened this issue 4 years ago • 7 comments

The following method does not open the printer selection window in iOS:

cordova.plugins.printer.pick({ top: 40, left: 30 }, callback);

The method returns null.

cordova.plugins.printer.print() works as expected.

mjirian avatar Nov 02 '20 14:11 mjirian

Same for me. IOS 14 iPad. image

1nstinct avatar Dec 13 '20 04:12 1nstinct

Same here. iPad Pro(4th generation). Hope this issue would solved soon.

Phoenix-Alpha avatar Dec 22 '20 08:12 Phoenix-Alpha

Hey guys. I think I found the solution. The plugin includes platform detection inside the code. The platform detection uses navigator.userAgent.indexOf('ipad') || navigator.userAgent.indexOf('iphone') to detect if the code is running on iPad or iPhone. I removed the line for isIOS check and it started working like a charm. This is a temporary solution but it's better than nothing. Later you can unbranch from master, create your own repository and use it with this fix for later plugin install actions. Go to /cordova-plugin-printer/www/printer.js image

1nstinct avatar Dec 28 '20 03:12 1nstinct

Dude that's amazing, thanks for figuring this out 💪

Zwimber avatar Nov 14 '21 15:11 Zwimber

This must still be an issue because I'm struggling to get the pick method to fire on iOS 15

kieranbarlow avatar Aug 01 '22 10:08 kieranbarlow

Removed the same isIOS and that got things working, thanks @1nstinct

Is this project still being maintained?

kieranbarlow avatar Aug 01 '22 11:08 kieranbarlow

Thanks @1nstinct for finding the origin of the bug ❤️. Personally, I added a check in the isIOS variable on a fork of the project.

|| window.cordova.platformId === "ios"

image

I created a PR hoping that @katzer would merge the fix 🤞🏻. https://github.com/katzer/cordova-plugin-printer/pull/293

dimer47 avatar Aug 01 '22 15:08 dimer47