如何阻止栏重叠

时间:2016-06-28 06:37:01

标签: php barcode

我有条形码生成code

实际的生成部分是:

$valoare = substr($code_string, ($position-1), 1);
            if($valoare==1)
                $cur_size = 0.5;
            elseif($valoare==2)
                $cur_size = 1;
            elseif($valoare==3)
                $cur_size = 1.5;
            elseif($valoare==3)
                $cur_size = 2;
            if ( strtolower($orientation) == "horizontal" )
                draw_bar($cur_size, ($position % 2 == 0 ? $white : $black) );

功能draw_bar:

function draw_bar($cur_size, $color){

    ?>
    <div style="width:<?php echo $cur_size?>; height:40px; background-color:<?php echo $color; ?>;float:left; position:relative"></div>
    <?php
}

对于$cur_size的大值,生成的条形码是正确的。 对于较小的尺寸,条形重叠,所以不是两个由白色空间隔开的小条,而是一个大条形。我放大的越多,条形码会调整为正确的形式。

这是两张图片,第一张图片不正确,第二图片正确,缩放200%后。

enter image description here

enter image description here

如何阻止小尺寸重叠?

谢谢!

0 个答案:

没有答案