#QRCode
Grail plugin project - Create QRCode and can put your logo to QRCode image
The plugin support both of service and taglib.
#About function:
- Create qrcode for a text
- Create qrcode for a contact - MECARD (Please see: http://www.nttdocomo.co.jp/english/service/developer/make/content/barcode/function/application/addressbook/index.html)
- Create qrcode follow google api (Please see: https://developers.google.com/chart/infographics/docs/qr_codes)
- And In each case you can put your logo in this qrcode image by link or by base64 string or object
#About technique:
- You can use service for customize your business functions. It supported you generate qrcode image for many types that you wanna do, etc:
- You can write down your disk
- You can get BufferedImage
- You also can get Base64 string as well
- About logo image, It also support system path, URL or Base64 String as well,
#Installation
grails install-plugin qr-code
#Using
##User Information
Map information = [:] def contactInfo = "MECARD:N:Tung,Ly;ADR:76 9th Avenue, 4th Floor, New York, NY 10011;"\ + "TEL:+84906667100;EMAIL:tyanhly@example.com;;" information.put("chs", "250x250") information.put("cht", "qr") information.put("chl", contactInfo) information.put("chld", "H|1") information.put("choe", "UTF-8") QRCodeService.createQRCode(information, "/local/logo.jpg", "/local", "qrcode.png")
or
def bytes = new URL("http://upload.wikimedia.org/wikipedia/commons/5/51/Google.png").getBytes() def data = bytes.encodeBase64().toString() QRCodeService.createQRCodeAndLogoBase64(information, data, "/local", "google.png" )
##Contact information
def contactInfos = [:] contactInfos.put("FIRSTNAME", "Tung") contactInfos.put("LASTNAME", "Ly") contactInfos.put("ADR", "124 Cao Xuan Duc P12 Q8 HCM") contactInfos.put("TEL", "0906667100") contactInfos.put("TEL-AV", "+84906667100") contactInfos.put("EMAIL", "tyanhly@yahoo.com") contactInfos.put("URL", "http://kiss-concept.com") contactInfos.put("BDAY", "1985/01/01") QRCodeService.createContactQRCode(contactInfos, \ "http://upload.wikimedia.org/wikipedia/commons/5/51/Google.png", \ "/local", "qrcode2.png")
or
def bytes = new URL("http://upload.wikimedia.org/wikipedia/commons/5/51/Google.png").getBytes() def data = bytes.encodeBase64().toString() QRCodeService.createContactQRCodeAndLogoBase64(contactInfos, data, "/local", "ibm.png" )
##TagLib using
<qrcode:text>Hello QRCode Plugin for Grails</qrcode:text>
<qrcode:text
logoLink="http://upload.wikimedia.org/wikipedia/commons/5/51/Google.png">
Hello QRCode Plugin for Grails
</qrcode:text>
<qrcode:text
logoLink="http://upload.wikimedia.org/wikipedia/commons/5/51/Google.png">
http://google.com
</qrcode:text>
<qrcode:google information="${information}" />
<qrcode:google information="${information}" logoLink="http://upload.wikimedia.org/wikipedia/commons/5/51/Google.png" />
<qrcode:contact contactInfos="${contactInfos}" />
<qrcode:contact contactInfos="${contactInfos}" logoLink="http://upload.wikimedia.org/wikipedia/commons/5/51/Google.png"/>
<qrcode:contact contactInfos="${contactInfos}" logoLink="~/Pictures/Google.png"/>
<qrcode:contact contactInfos="${contactInfos}" logoBase64="/9j/4AAQSk...SyCNxA6BP/9k="/>