Opaque qr code not showing?
I am trying to show a barcode on a webpage. All encoders are displayed except for the QR code. I read that two jar files are needed for this.
- barcode4j: 2.1
- qrgen: 1.4
I added these jar files to lib folder and try to run it. So I get 404 error when I add qrgen to lib folder.
I tried to do it using maven and added a dependency like this:
<dependency>
<groupId>net.glxn</groupId>
<artifactId>qrgen</artifactId>
<version>1.4</version>
</dependency>
<dependency>
<groupId>net.sf.barcode4j</groupId>
<artifactId>barcode4j-light</artifactId>
<version>2.1</version>
</dependency>
but I am getting error for the second dependency, so I copied the barcode4j file to the lib, but I cannot print the QR code. Help me help.
code for xhtml
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:p="http://primefaces.org/ui">
<h:head>
<title>login</title>
</h:head>
<h:body>
<p:panelGrid columns="2">
<h:outputText value="Interleaved 2 of 5" />
<p:barcode value="0123456789" type="int2of5" />
<h:outputText value="Codabar" />
<p:barcode value="0123456789" type="codabar"/>
<h:outputText value="Code39" />
<p:barcode value="0123456789" type="code39" />
<h:outputText value="Code128" />
<p:barcode value="0123456789" type="code128"/>
<h:outputText value="EAN-8" />
<p:barcode value="20123451" type="ean8"/>
<h:outputText value="EAN-13" />
<p:barcode value="0123456789012" type="ean13"/>
<h:outputText value="UPC-A (PNG)" />
<p:barcode value="01234567895" type="upca" format="png"/>
<h:outputText value="UPC-E (Vertical)" />
<p:barcode value="01234133" type="upce" orientation="90"/>
<h:outputText value="PDF417" />
<p:barcode value="0123456789" type="pdf417"/>
<h:outputText value="DataMatrix" />
<p:barcode value="0123456789" type="datamatrix"/>
<h:outputText value="Postnet" />
<p:barcode value="0123456789" type="postnet"/>
<h:outputText value="QR" />
<p:barcode value="0123456789" type="qr"/>
</p:panelGrid>
</h:body>
</html>
pom.xml
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.prime</groupId>
<artifactId>primedemop</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>primefaces</name>
<dependencies>
<dependency>
<groupId>com.sun.faces</groupId>
<artifactId>jsf-api</artifactId>
<version>2.2.2</version>
</dependency>
<dependency>
<groupId>com.sun.faces</groupId>
<artifactId>jsf-impl</artifactId>
<version>2.2.2</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.0.1</version>
</dependency>
<dependency>
<groupId>org.primefaces</groupId>
<artifactId>primefaces</artifactId>
<version>5.1</version>
</dependency>
<dependency>
<groupId>net.glxn</groupId>
<artifactId>qrgen</artifactId>
<version>1.4</version>
</dependency>
</dependencies>![smaple][2]
</project>
+3
source to share