soldair / node-qrcode

qr code generator
MIT License
7.57k stars 631 forks source link

vCard and QR code demo / example #170

Open dtmzr opened 5 years ago

dtmzr commented 5 years ago

Someone asked on a vCard and QR code integration in this issue at vcards-js.

I created a little app example for this scenario.

Just wanted to hint it out if someone is looking for this kind of solution.

Feel free to use it as demo if you guys are interested and if you want I can add you as a collaborator too.

sidharth3 commented 5 years ago

Hey! This link seems invalid presently, could you please check on it? Thank you

dtmzr commented 5 years ago

@sidharth3 sorry, I mixed up this repo and made it private by accident. The link works again! :)

If you have any questions about that, feel free to ask at any time!

Craig-Burch commented 5 years ago

Hi @dtmzr I have checked out the thread you linked. Cool stuff!! I am wrapping up a project identical to yours it sounds like. I am just using DynamoDB instead of Mongoose. Anyways, wondering if you have any thoughts on being able to compress the qrcode when filling it with a vCard?.. I only have 12 fields or so and the qrcode is turning up just absolutely massive! I am forced to used 'version: 15' when ideally I would like to use 'version: 7' for the qrcode.

Best Regards!

Craig Burch (5)

BEGIN:VCARD VERSION:3.0 FN;CHARSET=UTF-8:Craig Burch N;CHARSET=UTF-8:Burch;Craig;;; EMAIL;CHARSET=UTF-8;type=WORK,INTERNET:craig.burch@vivi PHOTO;ENCODING=b;TYPE=JPEG:https://sys.s3.us-east-5.amazonaws.com/1559679479116 TEL;TYPE=CELL:9084468857 ADR;CHARSET=UTF-8;TYPE=WORK:;;959 Yamato Rd #191;Boca Raton;FL;33431; TITLE;CHARSET=UTF-8:Developer Intern URL;type=WORK;CHARSET=UTF-8:https://ViViHoldings.com REV:2019-07-02T18:16:46.271Z END:VCARD

dtmzr commented 5 years ago

Hey @Craig-Burch sounds cool! As far as I know, this isn't caused by the library but the data you're writing to the QR code. The larger the string you write into the code, the more tiles you'll need which means the file will be bigger.

You may wanna mess around with these little links, it should give you a feel how much the number of tiles can say about the data that's saved in the QR code. Paste the vCard string into text and download the QR: https://zxing.appspot.com/generator Upload the QR to see what's in: https://zxing.org/w/decode.jspx

If you want to see a "live reaction" check this out: http://goqr.me/de/qr-code-visitenkarte-vcard/

As far as I know, there are two optimizations for this case:

  1. Only add fields which you fill into the vCard string.

  2. Make the vCards remotely available. In this case, you would just save the URL of the vCard into the QR code. The real cool feature is that you can change the vCard even after printing the QR code, the downside, you can't read the vCard if you can't access it e.g. deleted or no internet connection.

Btw. is the declaration of the charset really necessary in this case? Because if I look up the vCard standards it says > 3.0 should be UTF-8 and > 4.0 must be UTF-8. Cutting this away would make the QR's a little smaller too.

Craig-Burch commented 5 years ago

@dtmzr Thank you for the response and the links! 2 makes a lot of sense, I didn't realize how data heavy vCards were until now. The following finally gave me that light bulb above my head.

http://www.binarynow.com/wordpress/wp-content/uploads/2012/06/SlimPublisher4_qr.png

I will take a peek at the charset advice as well! Thanks Again!

soldair commented 5 years ago

just mentioning it here because i'm not sure if this was tried. error correction level has a huge impact in the number of modules required to render the code.

the lower error correction the smaller the code but also with really low error correction you might not be able to render images in the middle.

{ errorCorrectionLevel: 'L' }

https://github.com/soldair/node-qrcode#error-correction-level

twf-nikhila commented 4 years ago

@Craig-Burch how did you added the logo in the middle of qr code?