Choose Your Language

Thursday 12 September 2013

Generate QRCode using java

import java.io.*;
import java.util.Date;
import net.glxn.qrgen.image.ImageType;

public class QRCode {
    public static void main(String[] args) {
        ByteArrayOutputStream out = net.glxn.qrgen.QRCode.from("Aravind Sankaran").to(ImageType.PNG).stream();
 Date d=new Date();
 String filename="c:\\"+d.getTime()+".png";
        try {           
            FileOutputStream fout = new FileOutputStream(new File(filename));
            fout.write(out.toByteArray());
            fout.flush();
            fout.close();
        } catch (FileNotFoundException e) {
                       e.printStackTrace();
        } catch (IOException e) {
                       e.printStackTrace();
        }
    }
}

jar file:
qrgen-1.0.jar
zxing-core-1.7.jar
zxing-j2se-1.7.jar


1 comment:

  1. You are excellent.Thanks for your sharing,i learn a lot from your post.There is a lot of very useful knowledge in your post.I enjoy reading it and hope to see more.Can you write more about generating QR Code using java?I am very interested in it.Waiting for your new post.

    ReplyDelete