I'm seeking an open source QR codes image generator component in java (J2SE), but the open source licence mustn't be a GPL licence (needs to be included in a close source project).
BTW, i can't access the web from the project so no Google API.
I'm seeking an open source QR codes image generator component in java (J2SE), but the open source licence mustn't be a GPL licence (needs to be included in a close source project).
BTW, i can't access the web from the project so no Google API.
Mercer - no, there is an encoder in the library too. com.google.zxing.qrcode.encoder. We provide that in addition to an example web app using Google Chart APIs
ZXing is is an open-source, multi-format 1D/2D barcode image processing library implemented in Java. It is released under the The Apache License, so it allows use of the source code for the development of proprietary software as well as free and open source software.
MatrixToImageWriter uses BitMatrix, not ByteMatrix as returned by QRCode.getMatrix. by looking at android sourcecode, I found the following proof of concept solution:
try {
MultiFormatWriter writer = new MultiFormatWriter();
Hashtable hints = new Hashtable();
hints.put( EncodeHintType.ERROR_CORRECTION, ErrorCorrectionLevel.Q );
MatrixToImageWriter.writeToFile( writer.encode( "hello world", BarcodeFormat.QR_CODE, 800, 800, hints ),
"png", new File( "/tmp/qrcode.png" ) );
} catch ( Exception e ) {
System.out.println( "failure: " + e );
}
btw imposing Hashtable in API is not clean. please use Map. not many people still use Hashtable anyway, you should almost always use HashMap instead (except a few use cases).