How to Write and Read QR Code with ZXing in Java

ZXing is an open-source, 1D/2D barcode image processing library implemented in Java. The supported barcode formats include UPC-A, UPC-E, EAN-8, Code 93, Code 128, QR Code, Data Matrix, Aztec, PDF 417, etc. Besides the Java version, developers can leverage other ported projects such as QZXing, zxing-cpp, zxing_cpp.rb, python-zxing and ZXing .NET to quickly make barcode reader or writer software. According to the visualization report of Google trends, QR code seems to be the most popular barcode format since 2009. In this post, I’d like to share how to use ZXing to create QR code writer and reader for both desktop Java applications and Android mobile apps.

Read more

How to Deploy JavaScript QR Code Generator to Google App Engine

Recently, I found an excellent jQuery plugin jquery.qrcode.js, which is written by Jerome Etienne. In this article, I would like to share how to use the QR code plugin to implement a free online app with Google App Engine. You can try my demo http://dynamsoft-test.appspot.com/.

qr code

How to Implement QR Code Generator

<script src="js/jquery.min.js"></script>
<script src="js/jquery.qrcode.min.js"></script>
<script src="js/utf-8.js"></script>
  • Create a text input, a button, and an area for QR code display.
<input type="text" id="text" placeholder="www.dynamsoft.com">
<button onclick="generate()">Try it</button>
<div id="output"></div>
  • Add JS code for button event.
function generate()
{
	jQuery(function(){
		var canvas = document.querySelector("canvas");
		if (canvas != null && canvas.parentNode) {
			canvas.parentNode.removeChild(canvas);
		}
		var text = document.getElementById("text");
		jQuery('#output').qrcode(Utf8.encode(text.value));
		text.value = "";
	})
}
  • You can run it now.

How to Deploy the App to Google App Engine

  • There are four programming languages supported. I would like to pick PHP.

application

  • Change the qrcode.html to qrcode.php.
  • Create a configuration file named app.yaml with the following contents:
application: dynamsoft-test
version: 1
runtime: php
api_version: 1

handlers:
- url: /stylesheets
  static_dir: stylesheets

- url: /js
  static_dir: js

- url: /.*
  script: qrcode.php
  • Modify the source code for loading css and scripts:
<link type="text/css" rel="stylesheet" href="/stylesheets/main.css" />
<script src="/js/jquery.min.js"></script>
<script src="/js/jquery.qrcode.min.js"></script>
<script src="/js/utf-8.js"></script>
  • In the command line tool, type in python google_appengine/dev_appserver.py qrcode/
  • Visit http://localhost:8080/ to check your app.
  • If there is no error, you can upload the project to Google App Engine by the command appcfg.py update qrcode/

Now, you can visit the app domain to have fun. If you have any questions, please feel free to contact {desmond at Dynamsoft dot com}.

 

How to implement a simple barcode scan application on Android

Barcode scanning, especially QR code scans, are now widely used in various applications. This includes advertisements, newspapers, social networks, signage, and so on. The growth of QR codes is in large part due to the smartphone market’s booming growth. As a result, scanning technology tends to be more and more useful and important to businesses and consumers. In this article, we will take a glimpse on how to implement a simple barcode scan application on the Android platform.

Read more