Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Print QR Code In Console

Usages

Add maven dependency in pom.xml:

<dependency>
    <groupId>pro.leaco.qrcode</groupId>
    <artifactId>console-qrcode</artifactId>
    <version>1.0.1</version>
</dependency>

Print QR code in console

Use the following code (java or kotlin):

ConsoleQrcode.print("https://www.github.com");

The console will print the QR code as following:

example


Get the unicode QR code string

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:

example

About

print qrcode in console; generate unicode qrcode string; 在控制台中打印出二维码;生成unicode二维码字符串

Topics

Resources

Stars

3 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages