getBarcodeData($code, $type); // replace table for special characters $repstr = array("\0" => '', '&' => '&', '<' => '<', '>' => '>'); $width = round(($barcodeData['maxWidth'] * $widthFactor), 3); $svg = '' . "\n"; $svg .= '' . "\n"; $svg .= '' . "\n"; $svg .= "\t" . '' . strtr($barcodeData['code'], $repstr) . '' . "\n"; $svg .= "\t" . '' . "\n"; // print bars $positionHorizontal = 0; foreach ($barcodeData['bars'] as $bar) { $barWidth = round(($bar['width'] * $widthFactor), 3); $barHeight = round(($bar['height'] * $totalHeight / $barcodeData['maxHeight']), 3); if ($bar['drawBar']) { $positionVertical = round(($bar['positionVertical'] * $totalHeight / $barcodeData['maxHeight']), 3); // draw a vertical bar $svg .= "\t\t" . '' . "\n"; } $positionHorizontal += $barWidth; } $svg .= "\t" . '' . "\n"; $svg .= '' . "\n"; return $svg; } }