diff --git a/imprimir_etiquetas_termica.php b/imprimir_etiquetas_termica.php
index f9c4191e..e477d550 100644
--- a/imprimir_etiquetas_termica.php
+++ b/imprimir_etiquetas_termica.php
@@ -16,7 +16,7 @@ if (empty($codes)) {
getBarcode($code, 1.0, 100, 'black', 0);
+ // Narrow bar: 0.25mm (2 dots), Height: 11.5mm, Quiet Zone: 4mm
+ echo $generator->getBarcode($code, 0.25, 11.5, 'black', 4);
?>
diff --git a/includes/barcode_generator.php b/includes/barcode_generator.php
index bedd3119..6a90abea 100644
--- a/includes/barcode_generator.php
+++ b/includes/barcode_generator.php
@@ -1,5 +1,5 @@
barcode_codes = $this->getCode128Map();
}
- public function getBarcode($code, $widthFactor = 1, $height = 50, $foregroundColor = 'black', $barReduction = 0)
+ public function getBarcode($code, $narrowBarWidth = 0.25, $height = 11.5, $foregroundColor = 'black', $quietZoneMM = 4, $type = 'C128')
{
- $barcodeData = $this->getBarcodeData($code);
+ $barcodeData = ($type === 'C39') ? $this->getBarcodeData39($code) : $this->getBarcodeData($code);
if (!$barcodeData) return '';
$bars = '';
- $quietZone = 10;
- $x = $quietZone;
+ $x = $quietZoneMM;
$barArray = str_split($barcodeData['bars']);
for ($i = 0; $i < count($barArray); $i++) {
$val = (int)$barArray[$i];
- $width = $widthFactor * $val;
- if ($i % 2 == 0) { // Even indices are bars, odd are spaces
- // Apply bar reduction to increase white space between bars
- $drawWidth = max(0.4, $width - $barReduction);
- $bars .= '
';
+ $width = $narrowBarWidth * $val;
+ if ($i % 2 == 0) { // Even indices are bars
+ $bars .= '
';
}
$x += $width;
}
- $totalWidth = $x + $quietZone;
- $svg = '