This API is based on library available on the links below:
https://www.npmjs.com/package/cordova-plugin-document-scanner
https://github.com/NeutrinosPlatform/cordova-plugin-document-scanner/tree/ver/3.x.x
This plugin uses an API to scan the document using camera (iOS and Android), defined in a global scan object. The plugin does provide edge detection while scanning.
The Cordova API also has a function to choose an image from the system's photo library (only for Android).