Play with the options values and generates nice QR Codes.
Source
<h:panelGrid columns="2" style="margin-bottom:10px" cellpadding="5">
<h:outputText value="Render method: " />
<p:selectOneButton value="#{qrCodeController.renderMethod}">
<f:selectItem itemLabel="canvas" itemValue="canvas" />
<f:selectItem itemLabel="image" itemValue="img" />
<f:selectItem itemLabel="div" itemValue="div" />
</p:selectOneButton>
<h:outputText value="Render mode:" />
<p:selectOneButton value="#{qrCodeController.mode}">
<f:selectItem itemLabel="normal" itemValue="0" />
<f:selectItem itemLabel="label strip" itemValue="1" />
<f:selectItem itemLabel="label box" itemValue="2" />
<f:selectItem itemLabel="image strip" itemValue="3" />
<f:selectItem itemLabel="image box" itemValue="4" />
</p:selectOneButton>
<h:outputText value="Size:" />
<h:panelGrid columns="1">
<h:inputHidden id="txt2" value="#{qrCodeController.size}" />
<p:slider minValue="50" maxValue="500" for="txt2" style="width:200px"/>
</h:panelGrid>
<h:outputText value="Fill color:" />
<p:colorPicker value="#{qrCodeController.fillColor}"/>
<p:commandButton value="update" update="qrCodeElem"/>
</h:panelGrid>
<p:separator/>
<pe:qrCode id="qrCodeElem"
renderMethod="#{qrCodeController.renderMethod}"
renderMode="#{qrCodeController.mode}"
text="#{qrCodeController.text}"
label="#{qrCodeController.label}"
size="#{qrCodeController.size}"
fillColor="#{qrCodeController.fillColor}"
fontName="Ubuntu"
fontColor="#01A9DB"
ecLevel="H"
radius="0.5"/>
@Named("qrCodeController")
@ViewScoped
public class QRCodeController implements Serializable {
private static final long serialVersionUID = 20120316L;
private String renderMethod;
private String text;
private String label;
private int mode;
private int size;
private String fillColor;
public QRCodeController() {
renderMethod = "canvas";
text = "http://primefaces-extensions.github.io/";
label = "PF-Extensions";
mode = 2;
fillColor = "7d767d";
size = 200;
}
public String getRenderMethod() {
return renderMethod;
}
public void setRenderMethod(final String renderMethod) {
this.renderMethod = renderMethod;
}
public String getText() {
return text;
}
public void setText(final String text) {
this.text = text;
}
public String getLabel() {
return label;
}
public void setLabel(final String label) {
this.label = label;
}
public int getMode() {
return mode;
}
public void setMode(final int mode) {
this.mode = mode;
}
public String getFillColor() {
return fillColor;
}
public void setFillColor(final String fillColor) {
this.fillColor = fillColor;
}
public int getSize() {
return size;
}
public void setSize(final int size) {
this.size = size;
}
}