php - Loop barcode generator error -
i'm working barcode , using barcodephp library. it's working , want loop barcode , manage barcode position. problem seems library won't work when added echo "br" nor table. when added "br" or table barcode broke (won't show). here's result image:
and here's code:
require_once('layout/class/bcgfontfile.php'); require_once('layout/class/bcgcolor.php'); require_once('layout/class/bcgdrawing.php'); require_once('layout/class/bcgcode128.barcode.php'); // arguments r, g, , b color. $colorfont = new bcgcolor(0, 0, 0); $colorback = new bcgcolor(255, 255, 255); $font = new bcgfontfile('layout/class/font/arial.ttf', 18); $drawexception = null; try { $code = new bcgcode128(); $code->setscale(2); // resolution $code->setthickness(30); // thickness $code->setforegroundcolor($colorfont); // color of bars $code->setbackgroundcolor($colorback); // color of spaces $code->setfont($font); // font (or 0) } catch(exception $exception) { $drawexception = $exception; } $drawing = new bcgdrawing('', $colorback); if($drawexception) { $drawing->drawexception($drawexception); } else { //for($i=0; $i<3; $i++) { $code->parse('testing barcode'); // text $drawing->setbarcode($code); $drawing->draw(); //} header('content-type: image/png'); $drawing->finish(bcgdrawing::img_format_png); }
here's code breakline:
for($i=0; $i<3; $i++) { echo '<br>'; //won't work $code->parse('testing barcode'); // text $drawing->setbarcode($code); $drawing->draw(); echo '<br>'; //won't work either }
so found other way:
in barcode file changed line:
$code->parse($_get['tmp']); // text
and called other file this:
for($i=0; $i<3; $i++) { echo '<img src="print.php?tmp="asdada"><br><br>'; }
Comments
Post a Comment