martes, 3 de mayo de 2016

Barcode and QR code as service

In several of my projects, in different leguajes, I had the need to generate some kind of bar code and lately also need to generate QR codes. The problem was always how to get that functionality integrated development, either as native library or using some external service.In both cases I have found that the disadvantages are many and the risk of use them is important. For native libraries, not always there is one for the language we are using, because either does not exist, license cost, etc.
In the case of external services, although it is very comfortable just call the service and retrieve an image, they can cease to exist, become very slow,
or just internet access is not an option.For those reasons I decided to create a simple server that allows the generation of certain barcodes and QR (I've needed so far) locally. The project is posted on GitHub at: https://github.com/padiazg/barcode-as-a-service
 Currently it can generate codes for EAN13, CODE39, CODE129, PDF417 and QR. The list can be extended to other types that supports the Rescode package in which this project is based.To put it to work we must follow these steps:
  1.     Node.js must be installed  (the last version is recommended)
  2.     Download the project in any folder
  3.     Open a console and go to the folder where you just downloaded the project
  4.     Run npm install to download the required packages
  5.     Run node barcode-service

Once the service is  running, we can point a browser at port 3000 of the host for a brief example of using the service.Comments and any feedback would be appreciated.


Actualización: 

V1.1 (09/mayo/2016)
  • Solved a problem with fonts, related to the scale of the output.
  • Added paramater "scale", to specify a desired scale for the gnerated image.
  • Added parameter "fmt", to choise the imege format.
  • Implemented generation for "DataMatrix" 
  • The internal procedure is simplified.
In order to generate JPG output GraphicsMagick is needed, it's just download and install the right version for your system, bejore run the server.

Don't forget to update the requirements whit npm install after upgrading to the new version.