QR4J is a Java library for generating QR codes. QR4J is intended to be:
-
self-contained: no network API hits to any external services; and
-
minimally-dependent: using QR4J should not involve pulling in a plethora of JARs, and ideally none at all.
QR4J is not intended to:
-
read QR codes; or
-
generate any other type of barcode.
Generating a QR code is this simple:
QrCode qr = QrCode.encodeText("Hello, world!", QrCode.Ecc.LOW);
BufferedImage img = qr.toImage(10, 4);
File imgFile = new File("hello-world-QR.png");
ImageIO.write(img, "png", imgFile);
Or in a web application, you could just return SVG:
return qr.toSvg(4, "#cccccc", "#333333");
You can use QR4J in your projects by including it as a Maven dependency:
<dependency>
<groupId>net.logicsquad</groupId>
<artifactId>qr4j</artifactId>
<version>1.1</version>
</dependency>
By all means, open issue tickets and pull requests if you have something to contribute.
QR4J is heavily based on
QR Code generator library,
specifically the io.nayuki.fastqrcodegen package.
-
Why not fork that project? Because the repository includes implementations in languages we're not interested in.
-
Why not use that project's Java release? Because it doesn't appear that the
io.nayuki.fastqrcodegenpackage is even released as a JAR available on Maven Central.