insightautos / cordova-gmv-barcode-scanner

A Cordova barcode scanning plugin based on the Google Mobile Vision library for iOS & Android.
MIT License
52 stars 77 forks source link

Not detecting encrypted PDF 417 barcodes #30

Open johnagar opened 4 years ago

johnagar commented 4 years ago

I am testing the plugin to read the South African drivers license which is in PDF 417 format but the data is encrypted. I have done tests on other PDF 417 codes that contain plain text and these work fine. The plugin may have some built code that is trying to interrupt the scanned data, which will clearly fail with encrypted data. Is that a way to get the raw data returned and my Javascript code takes it from there?

John Agar

thirion commented 4 years ago

Hi John. What I did was add an extra parameter for isBinary when scanning. When returning the result and isBinary is true I convert it to HEX and return that in the callback instead.

Since the SA Drivers License is encrypted and encoded (and apparently nobody has the spec for it) you have to send it to a third party for decryption.

I had some trouble with this recently when trying to build a project with more recent versions of Corova, Node, Npm, Android platform etc.. I ended up using this plugin and just added my isBinary functionality: https://github.com/Ratsoc/cordova-plugin-google-mobile-vision-barcode-scanner. Now that plugin is giving me issues building on iOS, but that's another story.

== Ok, so I've gotten the other plugin to build on iOS as well, but your issue got me thinking: The other plugin returns the raw data by default instead of the text representation like this one, so if you can convert the binary to hex in javascript you don't need to modify the plugin at all. I tested it today and it's working well. Let me know if you need more info