Created
April 21, 2014 10:33
-
-
Save jozsef-vesza/11138874 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
String returnString = "mystring"; | |
Writer writer = new QRCodeWriter(); | |
BitMatrix encoded = null; | |
try | |
{ | |
encoded = writer.encode(returnString, BarcodeFormat.QR_CODE, 300, 300); | |
} | |
catch (WriterException ex) | |
{ | |
Logger.getLogger(QRService.class.getName()).log(Level.SEVERE, null, ex); | |
} | |
ByteArrayOutputStream outs = new ByteArrayOutputStream(); | |
MatrixToImageWriter.writeToStream(encoded, "PNG", outs); | |
resp.setContentType("image/png"); | |
resp.getOutputStream().write(outs.toByteArray()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment