8000 GitHub - jasw/QRGen: a simple QRCode generation api for java built on top ZXING
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

jasw/QRGen

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

90 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build Status

Donate

<script data-gittip-username="kenglxn" data-gittip-widget="button" src="//gttp.co/v1.js"> </script>

QRGen: a simple QRCode generation api for java built on top ZXING

Dependencies:

ZXING: http://code.google.com/p/zxing/

< 77F2 div class="markdown-heading" dir="auto">

Get it:

QRGen is available from Maven Central Repository using the following dependency declaration:

Gradle:

dependencies {
    compile ("net.glxn:qrgen:1.4")
}

Maven:

<dependencies>
    <dependency>
        <groupId>net.glxn</groupId>
        <artifactId>qrgen</artifactId>
        <version>1.4</version>
    </dependency>
</dependencies>

Or you can clone and build yourself:

git clone git://github.com/kenglxn/QRGen.git
cd QRGen/
mvn clean install

Usage:

// get QR file from text using defaults
File file = QRCode.from("Hello World").file();

// get QR stream from text using defaults
ByteArrayOutputStream stream = QRCode.from("Hello World").stream();

// override the image type to be JPG
QRCode.from("Hello World").to(ImageType.JPG).file();
QRCode.from("Hello World").to(ImageType.JPG).stream();

// override image size to be 250x250
QRCode.from("Hello World").withSize(250, 250).file();
QRCode.from("Hello World").withSize(250, 250).stream();

// override size and image type
QRCode.from("Hello World").to(ImageType.GIF).withSize(250, 250).file();
QRCode.from("Hello World").to(ImageType.GIF).withSize(250, 250).stream();

// supply own outputstream
QRCode.from("Hello World").to(ImageType.PNG).writeTo(outputStream);

// supply own file name
QRCode.from("Hello World").file("QRCode");

// supply charset hint to ZXING
QRCode.from("Hello World").withCharset("UTF-8");

// supply error correction level hint to ZXING
QRCode.from("Hello World").withErrorCorrection(ErrorCorrectionLevel.L);

// supply any hint to ZXING
QRCode.from("Hello World").withHint(EncodeHintType.CHARACTER_SET, "UTF-8");

// encode contact data as vcard using defaults
VCard johnDoe = new VCard("John Doe")
                    .setEmail("john.doe@example.org")
                    .setAddress("John Doe Street 1, 5678 Doestown")
                    .setTitle("Mister")
                    .setCompany("John Doe Inc.")
                    .setPhonenumber("1234")
                    .setWebsite("www.example.org");
QRCode.from(johnDoe).file();

License:

http://www.apache.org/licenses/LICENSE-2.0.html

About

a simple QRCode generation api for java built on top ZXING

Resources

Stars

Watchers

Forks

Packages

No packages published
0