NeutrinosPlatform / cordova-plugin-document-scanner

cordova plugin for document scan
https://www.neutrinos.co/
MIT License
85 stars 61 forks source link

java.lang.RuntimeException: Canvas: trying to draw too large(118591260bytes) bitmap. #67

Closed benediktcarda closed 4 years ago

benediktcarda commented 4 years ago

Describe the bug The cordova-plugin-document-scanner crashes with a fatal exception: "java.lang.RuntimeException: Canvas: trying to draw too large(118591260bytes) bitmap."

It occurs on my Samsung A7 phone (Android 9) and happens, if I choose a too large part of the photo to be the document. If I choose just a small fraction of the photo taken then the bug does not occur.

To Reproduce

Expected behavior The plugin should crop and skew the part of the photo chosen before and show the result on the screen.

Screenshots The crash is silent, not issuing any error message on the devices screen. I got the error message via the adb command of the Android platform-tools.

Smartphone (please complete the following information):

ChrisTomAlx commented 4 years ago

Hey @benediktcarda

Use the quality option to reduce the quality of the captured image. Let me know if this doesn't solve your issue.

Annotation 2020-01-19 010641

Cheers, Chris Neutrinos

benediktcarda commented 4 years ago

Hello Chris, yes, this helps. Still it is an uncatched fatal exception that should be dealt with by issuing some error message. Currently it leads to crashes of the app that uses the plugin. Still thank you very much for providing this package. Cheers, Benedikt.

ChrisTomAlx commented 4 years ago

You are right. There wasn't a catch block to catch such unexpected exceptions. I have added it and published Ver 4.2.2 of the plugin. Closing the issue for now. Feel free to reopen it if you think, it doesn't solve your issue.

Cheers, Chris Neutrinos