JsBarcode EAN-13 Error that barcode does not appear

146 views Asked by At

this article was written using Google Translator. I hope you understand even if there are some awkward grammar points.

Currently, we are working on extracting a barcode image through JsBarcode when a 13-digit barcode number is retrieved from the db. I plan to print this barcode image on a roll tag machine and use it in offline stores. However, contrary to expectations, we found that there was an issue in the process of taking the 13-digit barcode number and converting the barcode. I entered several barcode numbers and selected several barcodes, but while some barcodes displayed images normally, some displayed an error message on the console saying that they were not valid.

(Error -> Uncaught "7708000494924" is not a valid input for EAN13)

An error occurs in the barcode numbers above. This is an example of one error code being retrieved from several barcodes. I looked it up and found that ENA-13 has 13 digits, but it takes a 12-digit barcode number and substitutes a random number into the last digit as a validation (check) number. So, the strange thing here is that the remaining barcode numbers that are printed normally are 13 digits, but if an error occurs, all of them should be displayed and not all of them should be printed, but some of them work normally.

I would like to ask if anyone has solved this problem. The server is configured with PHP.

[a_ajax.php]

<div class="tag_print_style" id="tag_print_style" style="width:40mm;height:70mm">
    <div class="tag_main" style="margin-top:75px">
        <ul>
            <li class="barcode_li" style="margin-top:0">
                <img id="barcode_<?=$tack[$i]['barcode']?>" style="display:block;margin-left:0mm;width:30mm;image-rendering:-moz-crisp-edges;image-rendering:-o-crisp-edges;image-rendering:-webkit-optimize-contrast;image-rendering:crisp-edges;transform:translateZ(0);backface-visibility:hidden">
            </li>
            <li class="barcode_li" style="margin-top:0">
                <img id="barcode_<?=$tack[$i]['barcode']?>" style="display:block;margin-left:0mm;width:30mm;image-rendering:-moz-crisp-edges;image-rendering:-o-crisp-edges;image-rendering:-webkit-optimize-contrast;image-rendering:crisp-edges;transform:translateZ(0);backface-visibility:hidden">
            </li>
        </ul>
    </div>
</div>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/JsBarcode.all.min.js"></script>
$.getScript("<?= ASSET_JS_ROOT ?>/JsBarcode.all.js", function() {
JsBarcode("#barcode_<?=$pro_detail_cd_escaped?>", "<?=$tack[$i]['barcode']?>", {format:"EAN13",displayValue:true,width:3,fontSize:30,textMargin: 10,blank: 20,});});

I asked about this at GPT and checked several Google posts. When you change the format to CODE128 and print it, the barcode image appears normally. However, the argument is that CODE128 should not be used in offline stores and that it should only be EAN-13 because the format on offline scanner machines is EAN-13.

I could understand if the normal output didn't work at all, but I really don't understand because some things work and others don't. 7 708000 976655 O 7 708000 494924 X I know that EAN-13 has country code specifications and store product specifications. I've searched and tested for several days, but no progress has been made. Any help would be greatly appreciated.

0

There are 0 answers