https://github.com/lightweight-component/aj-qrcode
A Lightweight QR Code
https://github.com/lightweight-component/aj-qrcode
qrcode qrcode-generator
Last synced: about 2 months ago
JSON representation
A Lightweight QR Code
- Host: GitHub
- URL: https://github.com/lightweight-component/aj-qrcode
- Owner: lightweight-component
- License: apache-2.0
- Created: 2024-06-13T01:02:55.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2024-06-25T04:06:35.000Z (almost 2 years ago)
- Last Synced: 2025-01-16T21:25:06.449Z (over 1 year ago)
- Topics: qrcode, qrcode-generator
- Language: Java
- Size: 79.1 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[](https://central.sonatype.com/artifact/com.ajaxjs/aj-qrcode)
[](https://dev.ajaxjs.com/docs/javadoc/aj-qrcode/)
[](http://www.apache.org/licenses/LICENSE-2.0.txt)
[](mailto:frank@ajaxjs.com)
[](https://shang.qq.com/wpa/qunwpa?idkey=3877893a4ed3a5f0be01e809e7ac120e346102bd550deb6692239bb42de38e22)
# QR Code Generator
Forks from https://github.com/nayuki/QR-Code-generator. Puts normal version and fast version in one project.
Tutorial: https://zhangxin.blog.csdn.net/article/details/139821806.
Java Documents: https://dev.ajaxjs.com/docs/javadoc/aj-qrcode/.
## Install
```xml
com.ajaxjs
aj-qrcode
1.0
```
## Usage
```java
String text = "Hello, world!"; // User-supplied Unicode text
Ecc errCorLvl = Ecc.LOW; // Error correction level
QrCode qr = QrCode.encodeText(text, errCorLvl); // Make the QR Code symbol
BufferedImage img = Utils.toImage(qr, 10, 4); // Convert to bitmap image
File imgFile = new File("hello-world-QR.png"); // File path for output
ImageIO.write(img, "png", imgFile); // Write image to file
String svg = Utils.toSvgString(qr, 4, "#FFFFFF", "#000000"); // Convert to SVG XML code
File svgFile = new File("c:\\temp\\hello-world-QR.svg"); // File path for output
Files.write(svgFile.toPath(), svg.getBytes(StandardCharsets.UTF_8)); // Write image to file
```