Last updated by hartsock 1 year ago
grails install-plugin qrcode
Last updated by bdrhoa 1 year ago
Creates QRCode as part of your Grails application. A simple to use TagLib provides intuitive ways to embed QRCodes directly onto any page in your Grails application.
For example embedding this simple tag in your main.gsp will create a QRCode show/hide block on every page in your application allowing for easy sharing with an Android or iPhone device that has a QRCode barcode reader installed.
This tag creates a QRCode containing any text you want to embed in a QRCode:
<qrcode:image text="Some arbitrary text."/>
Last updated by hartsock 1 year ago
How are the QRCodes generated?
I used the fantastic libraries available at http://code.google.com/p/zxing/ to create a simple Java 2D PNG renderer object written in Groovy. It is this object that does most of the work and leverages the versitile ZXing libraries. The image rendering is done server-side using AWT and JAI libraries meaning you don't need to be on the open web to render QR Codes and can do so inside isolated environments.
How do I embed a QRCode for the URL of the GSP currently being rendered?
Embed one of the QrcodeTagLib tags in your main.gsp or wherever appropriate. You can use the url tag
which will encode the URL the browser is currently looking at inside a QRCode. You can also use the
tag which renders a QRCode hidden under a show/hide link for you. You can set the text of the show hide link like this
<qrcode:link label="My text goes here." />
or you can manually determine your url and have it rendered
<qrcode:image text="${myUrl}" width="128" height="128" />How do I create a QRCode with arbitrary text?
<qrcode:image text="my arbitrary text"/>
… but this is limited to what can be placed on a URL.
How do I use the QRCode generator directly?
First handle your request…
reqest.contentType = "image/png"
def outputStream = request.outputStream
… then render your QRCode containing any data you wish …
QRCodeRenderer qrcodeRenderer = new QRCodeRenderer()
qrcodeRenderer.renderPng("My Data Goes Here", widthOfPicture, outputStream)
… which means you can render any arbitrary text in your QRCode up to the maximum QRCode data limit.
Can I use this plugin with Google AppEngine?
In short: NO. Version 0.1 uses the following classes forbidden by Google AppEngine: java.awt.Color, java.awt.image.BufferedImage, java.awt.Graphics2D, java.awt.image.renderable.ParameterBlock, java.awt.Rectangle, java.awt.image.AffineTransformOp, java.awt.geom.AffineTransform, javax.media.jai.JAI, javax.media.jai.PlanarImage
If you can substitute non-blacklisted classes for these classes then it should be technically possible.
Last updated by hartsock 1 year ago
Produces QR Code barcodes that look like this: