public function getBarcodeSVGcode($w = 2, $h = 30, $color = 'black')
{
// replace table for special characters
$repstr = array("" => '', '&' => '&', '<' => '<', '>' => '>');
$svg = '<' . '?' . 'xml version="1.0" standalone="no"' . '?' . '>' . "\n";
$svg .= '<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">' . "\n";
$svg .= '<svg width="' . round($this->barcode_array['maxw'] * $w, 3) . '" height="' . $h . '" version="1.1" xmlns="http://www.w3.org/2000/svg">' . "\n";
$svg .= "\t" . '<desc>' . strtr($this->barcode_array['code'], $repstr) . '</desc>' . "\n";
$svg .= "\t" . '<g id="bars" fill="' . $color . '" stroke="none">' . "\n";
// print bars
$x = 0;
foreach ($this->barcode_array['bcode'] as $k => $v) {
$bw = round($v['w'] * $w, 3);
$bh = round($v['h'] * $h / $this->barcode_array['maxh'], 3);
if ($v['t']) {
$y = round($v['p'] * $h / $this->barcode_array['maxh'], 3);
// draw a vertical bar
$svg .= "\t\t" . '<rect x="' . $x . '" y="' . $y . '" width="' . $bw . '" height="' . $bh . '" />' . "\n";
}
$x += $bw;
}
$svg .= "\t" . '</g>' . "\n";
$svg .= '</svg>' . "\n";
return $svg;
}