getBarcodeData($barcode, $type); // replace table for special characters $repstr = [ "\0" => '', '&' => '&', '<' => '<', '>' => '>', ]; $width = round(($barcodeData->getWidth() * $widthFactor), 3); $svg = '' . PHP_EOL; $svg .= '' . PHP_EOL; $svg .= '' . PHP_EOL; $svg .= "\t" . '' . strtr($barcodeData->getBarcode(), $repstr) . '' . PHP_EOL; $svg .= "\t" . '' . PHP_EOL; // print bars $positionHorizontal = 0; /** @var BarcodeBar $bar */ foreach ($barcodeData->getBars() as $bar) { $barWidth = round(($bar->getWidth() * $widthFactor), 3); $barHeight = round(($bar->getHeight() * $height / $barcodeData->getHeight()), 3); if ($bar->isBar() && $barWidth > 0) { $positionVertical = round(($bar->getPositionVertical() * $height / $barcodeData->getHeight()), 3); // draw a vertical bar $svg .= "\t\t" . '' . PHP_EOL; } $positionHorizontal += $barWidth; } $svg .= "\t" . PHP_EOL; $svg .= '' . PHP_EOL; return $svg; } }