Add maven dependency in pom.xml:
<dependency>
<groupId>pro.leaco.qrcode</groupId>
<artifactId>console-qrcode</artifactId>
<version>1.0.1</version>
</dependency>
Use the following code (java or kotlin):
ConsoleQrcode.print("https://www.github.com");
The console will print the QR code as following:
Use the following code (java or kotlin):
//for kotlin
val code:String = ConsoleQrcode.print("https://www.github.com")
println(code);
//for java
String code = ConsoleQrcode.print("https://www.github.com");
System.out.println(code);
Then we can see the unicode QR code string like this:
█▀▀▀▀▀█ ██▀▀ █▀▀▀ █▀▀▀▀▀█
█ ███ █ ▄▄ ██▄ █ ███ █
█ ▀▀▀ █ ▄█▀▀█▄▄▄ █ ▀▀▀ █
▀▀▀▀▀▀▀ █▄█ ▀▄█ █ ▀▀▀▀▀▀▀
▄ ▄▀▀▄▀▄▄▀█ ▄█ ▄▀█▀ ▄ ██
█▄██▀▀▀ ▀▀▄█▀▀▀▀ ▀▄▄▀▀ ▄
▄█ ▀▄▀▀█ █▄ ▀▄▀█ ▀▄█▀██▄
██▀ █▀▀▄▄▀ ▄▄▄██▄▀ ▄▀ █▄
▀ ▀▀▀▀▀▀▀█▄█ █▄▄█▀▀▀█▄▄█▀
█▀▀▀▀▀█ ▄▀ ▀▄▀ █ ▀ █▀ █▄
█ ███ █ █▄▀▄▄█▀███▀▀█▄▀▀▀
█ ▀▀▀ █ ▀▀ ▀ ██ █▀▄
▀▀▀▀▀▀▀ ▀ ▀ ▀▀▀▀▀ ▀▀ ▀
But because of the line-high, we can not scan the QR code successfully. If we would like to use the unicode QR code, we can adjust the screen printer's line-high.
e.g.
<pre style="line-height: 12px;font-size: 12px;font-weight:normal">
█▀▀▀▀▀█ ██▀▀ █▀▀▀ █▀▀▀▀▀█
█ ███ █ ▄▄ ██▄ █ ███ █
█ ▀▀▀ █ ▄█▀▀█▄▄▄ █ ▀▀▀ █
▀▀▀▀▀▀▀ █▄█ ▀▄█ █ ▀▀▀▀▀▀▀
▄ ▄▀▀▄▀▄▄▀█ ▄█ ▄▀█▀ ▄ ██
█▄██▀▀▀ ▀▀▄█▀▀▀▀ ▀▄▄▀▀ ▄
▄█ ▀▄▀▀█ █▄ ▀▄▀█ ▀▄█▀██▄
██▀ █▀▀▄▄▀ ▄▄▄██▄▀ ▄▀ █▄
▀ ▀▀▀▀▀▀▀█▄█ █▄▄█▀▀▀█▄▄█▀
█▀▀▀▀▀█ ▄▀ ▀▄▀ █ ▀ █▀ █▄
█ ███ █ █▄▀▄▄█▀███▀▀█▄▀▀▀
█ ▀▀▀ █ ▀▀ ▀ ██ █▀▄
▀▀▀▀▀▀▀ ▀ ▀ ▀▀▀▀▀ ▀▀ ▀
</pre>
Then, we can get the correct QR code in web browser: