zxing-js / library

Multi-format 1D/2D barcode image processing library, usable in JavaScript ecosystem.
https://zxing-js.github.io/library/
Apache License 2.0
2.43k stars 541 forks source link

Scan and decode with another lib then use zxing-js to parse the result #426

Open psyzz opened 3 years ago

psyzz commented 3 years ago

Hello,

thanks for this lib,

I'm using react-native and i already have a library to scan a qrcode/barcode and get a string result from this scan, but i'm looking for a lib to parse the string result like the zxing lib do here : https://zxing.org/w/decode.jspx

Example with a vCard type :

zxingResult

What i'm looking for is the "Parsed Result".

Can i use this lib do to that with vCard and other qrcode types ?

Regards

odahcam commented 3 years ago

Yes, it's perfectly possible. I'll try to set up an example later.

psyzz commented 3 years ago

Hello @odahcam , thanks for your time.

Could you point me in the right direction ? I saw ResultParser in the java source code but i didn't find ResultParser in the js library.

Regards, Jérémy

odahcam commented 3 years ago

Hi! Sorry I didn't do anything yet. Could you provide more info on this string's format maybe? Could you post an example string in here as well? I need to find if and what we need to do to pass the data to the library for it to get correctly decoded.

psyzz commented 3 years ago

No problem, An example would be the string i posted on the screenshot, the "Raw text"

psyzz commented 3 years ago

Like this one :

BEGIN:VCARD VERSION:3.0 N:Gump;Forrest FN:Forrest Gump ORG:Bubba Gump Shrimp Co. TITLE:Shrimp Man PHOTO;VALUE=URL;TYPE=GIF:http://www.example.com/dir_photos/my_photo.gif TEL;TYPE=WORK;VOICE:(111) 555-1212 TEL;TYPE=HOME;VOICE:(404) 555-1212 ADR;TYPE=WORK:;;100 Waters Edge;Baytown;LA;30314;United States of America LABEL;TYPE=WORK:100 Waters Edge\nBaytown, LA 30314\nUnited States of America ADR;TYPE=HOME:;;42 Plantation St.;Baytown;LA;30314;United States of America LABEL;TYPE=HOME:42 Plantation St.\nBaytown, LA 30314\nUnited States of America EMAIL;TYPE=PREF,INTERNET:forrestgump@example.com REV:20080424T195243Z END:VCARD

And the goal will be to get the "Parsed Result" like in the screenshot

odahcam commented 3 years ago

So you confirm this is the string result the library you currently use gives you? If so, I'm not sure how ZXing can help, once it would get this information from the image you are scanning/decoding but ZXing is not a VCARD parser.

psyzz commented 3 years ago

Yes i confirm this is the string result the library i currently use gives me. Here is the ResultParser from zxing Java where the result is parsed : https://github.com/zxing/zxing/blob/master/core/src/main/java/com/google/zxing/client/result/ResultParser.java

As you can see there are many different ResultParser like this one : "SMSMMSResultParser" :

https://github.com/zxing/zxing/blob/d4c3d73592e86aff480afef62ebc20ae70165e38/core/src/main/java/com/google/zxing/client/result/SMSMMSResultParser.java#L41

ShishoA commented 2 years ago

@psyzz did you find a solution ? if so can you share it please ? Thank you

github-actions[bot] commented 4 months ago

Stale issue message