def QRCODE_IMAGE_HEIGHT = 300
def QRCODE_IMAGE_WIDTH = 300
//path where you want to save qrcode
def IMAGE_PATH = “C:/”
def hints = new HashMap()
hints.put(EncodeHintType.ERROR_CORRECTION, ErrorCorrectionLevel.H)
def qrWriter = new QRCodeWriter()
//Add your data instead of http://www.google.com
def matrix = qrWriter.encode(“http://www.google.com”,
BarcodeFormat.QR_CODE,
QRCODE_IMAGE_WIDTH,
QRCODE_IMAGE_HEIGHT,
hints)
//Draw the new image
def combined = new BufferedImage(QRCODE_IMAGE_HEIGHT, QRCODE_IMAGE_WIDTH, BufferedImage.TYPE_INT_ARGB)
def g = (Graphics2D)combined.getGraphics()
g.drawImage(image, 0, 0, null)
def imageFile = new File(IMAGE_PATH, “qrcode_logo2.png”)
ImageIO.write(combined, “PNG”, imageFile)
that gives the Runtime exception: could not find matching construct
I’ve found that http://stackoverflow.com/questions/9257038/how-to-create-qrcode-using-java-j2se
It’s very simple , but I’m not able to get It working
error : java.lang.NoSuchMethodError: com.google.zxing.Writer.encode(Ljava/lang/String;Lcom/google/zxing/BarcodeFormat;IILjava/util/Map;)Lcom/google/zxing/common/BitMatrix;
I’m doing something wrong, but I don’t know
respect to your original code I’ve changed the path (desktop rather than C:\ ), because of a privilege exception.
ByteArrayOutputStream out = QRCode.from(“Hello World”).to(ImageType.PNG).stream();
try {
FileOutputStream fout = new FileOutputStream(new File(“C:\…\Desktop”));
Sorry, I want to ask again.
Actually, it works when I run it with ‘evaluate’ button in connectors out box and set the necessary JARs manually! (as seen in pict below) 1
could it be automatically because I want to use it to generate qrcode based on user input? I’ve put it in LIB folder (C:\BonitaBPMCommunity-7.3.2\jre\lib).
Bonitasoft empowers development teams with Bonita, the open-source and extensible platform to solve the most demanding process automation use cases. The Bonita platform accelerates delivery of complex applications with clear separation between capabilities for visual programming and for coding. Bonita integrates with existing solutions, orchestrates heterogeneous systems, and provides deep visibility into processes across the organization.