Closed amismailz closed 8 years ago
Hello, your configurations is incorrect you're passing you model id to html element Id please pass your html element id eg :
<div id="showBarcode"></div>
use barcode\barcode\BarcodeGenerator as BarcodeGenerator;
$optionsArray = array( 'elementId'=> 'showBarcode', /* div or canvas id/ 'value'=> '4797001018719', / value for EAN 13 be careful to set right values for each barcode type _/ 'type'=>'ean13',/_supported types ean8, ean13, upc, std25, int25, code11, code39, code93, code128, codabar, msi, datamatrix*/
); echo BarcodeGenerator::widget($optionsArray);
No, You have miss-understanding, I have wrote the html element id same as mode id because its my case, below is all my code:
<?php if(!empty($models)) foreach ($models as $model){ ?>
<?php } ?>
<?php if(!empty($models)) foreach ($models as $model){ $optionsArray = array( 'elementId'=> $model->id, /* div or canvas id/ 'value'=> 'A'.$model->id.'B', / value for EAN 13 be careful to set right values for each barcode type _/ 'type'=>'codabar',/_supported types ean8, ean13, upc, std25, int25, code11, code39, code93, code128, codabar, msi, datamatrix*/ 'settings'=>['output'=>'css','barHeight'=>40] );
echo BarcodeGenerator::widget($optionsArray); } ?>
How can you predict the ids on a db table please use a static value, Please try the above example as it is then adjust your values.
Sorry for confusion. The code is successfully generated and no problem with generating, but the reader machine cannot scan the barcode and read its value, I think my problem is in selecting wrong barcode type or I should make some editing in number before generating barcode. I'm new with barcode types.
Happy to help and Glad It worked out. Happy coding.
How can I get generated bar code scannable ? I tried many times with barcode machine. Sorry, I am new with barcode systems
Are you trying it as a hard copy, even my nokia e71 picked the codes that I've generated.
Please check your machine with some merchadize, Then try
I've just tried from my android phone with QR & Barcode scanner app, It picks correctly.
Yes, its a hard copy & machine works with a merchandize and with your above example. I think my issue is in the type or the value to be encoded:
'value'=> 10004, 'type'=>'codabar', 'settings'=>['output'=>'css','barHeight'=>40]
I tried your code example with value "10004" not working.
It should satisfy the selected type length. try with a android phone. problem is with the scanner, try in a hard copy when trying with the scanner
Your value works with the phone it picks up quickly, you can try it too.
Many Many thanks @Vilochane You are right, the problem was in the scanner, It works in android barcode app. again, Many thanks, you helped my.
@amismailphp Glad I could help.
Hi, I am writing my code to generate bar code for ID in database, but when I tried to scan it with barcode it didn't wok. Below is my code: `$optionsArray = array( 'elementId'=> $model->id, 'value'=> $model->id, 'type'=>'codabar', 'settings'=>['output'=>'bmp','barHeight'=>40] );
echo BarcodeGenerator::widget($optionsArray); `