Create Automatic Barcode with Image while creating items

I want barcode to be automatically created with images while creating items. I have gone through some of the js codes provided in discussion forum but there’s not the proper way so that i can setup.

Anyone can please provide me a clear way to automatically create barcode images.

in item master add docfield “barcode” from customize and then print barcode anywhere you want to