Thursday, 5 November 2020

Very simple way to create barcode on web page in PHP.

 barcode or bar code is a method of representing data in a visual, machine-readable form. I have seen many programming techniques to create barcode, but all looks very complex to utilize in your code. Here I have found a simple way to create a barcode in a single line of code. Please see -

You need to download barcode generator file (barcode.php) from here :-

 https://github.com/davidscotttufts/php-barcode/

You will have to use this file on page where you want to generate the barcode like this-

<img alt="arvind" src="path_of_file/barcode.php?text=123456789&print=true" />

Resulted barcode will be -

Another variant of barcode is-
 
<img alt="arvind" src="path_of_file/barcode.php?codetype=Code39&size=60&text=123456789&print=true" />

Result will be -

And if you want it to create vertically then use this code -

<img alt="arvind" src="path_of_file/barcode.php?text=123456789&orientation=vertical&size=40" />

Result will be -

You will have to put your data into text property.

If you want to generate create bar code of dynamic data then you can use it as

<img alt="arvind" src="path_of_file/barcode.php?text=<?php echo $data; ?>&print=true" />

For more please visit-







No comments:

Post a Comment

Change image source dynamically on hyperlink

 Changing image source dynamically using JQuery. Here in this example I have created there hyperlink and stored all images in the same folde...