Vilochane / yii2-barcode-generator-8-types

This extension based on "Simple jQuery Based Barcode Generator" Wrapper for BarCode Coder Library (BCC Library Version 2.0) by DEMONTE Jean-Baptiste, HOUREZ Jonathan.
9 stars 13 forks source link

Barcode reader cannot scan codabar #2

Closed amismailz closed 8 years ago

amismailz commented 8 years ago

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); `

Vilochane commented 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);

amismailz commented 8 years ago

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); } ?>

Vilochane commented 8 years ago

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.

amismailz commented 8 years ago

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.

Vilochane commented 8 years ago

Happy to help and Glad It worked out. Happy coding.

amismailz commented 8 years ago

How can I get generated bar code scannable ? I tried many times with barcode machine. Sorry, I am new with barcode systems

Vilochane commented 8 years ago

Are you trying it as a hard copy, even my nokia e71 picked the codes that I've generated.

Vilochane commented 8 years ago

Please check your machine with some merchadize, Then try

Vilochane commented 8 years ago

I've just tried from my android phone with QR & Barcode scanner app, It picks correctly.

amismailz commented 8 years ago

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]

amismailz commented 8 years ago

I tried your code example with value "10004" not working.

Vilochane commented 8 years ago

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

Vilochane commented 8 years ago

Your value works with the phone it picks up quickly, you can try it too.

amismailz commented 8 years ago

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.

Vilochane commented 8 years ago

@amismailphp Glad I could help.