@php $w = ($format === '99014') ? 101 : 57; $h = ($format === '99014') ? 54 : 32; $dymoFix = isset($dymoFix) ? (bool) $dymoFix : false; $rot = isset($rot) ? (int) $rot : 0; $dx = isset($dx) ? (float) $dx : 0.0; $dy = isset($dy) ? (float) $dy : 0.0; $autoPrint = request()->has('autoprint') && filter_var(request()->query('autoprint'), FILTER_VALIDATE_BOOL); // Quando il driver DYMO ruota/ritaglia in modo diverso, alcuni transform finiscono fuori pagina. // dymo_mode permette di provare preset alternativi senza cambiare codice. $dymoMode = strtoupper(trim((string) request()->query('dymo_mode', 'A'))); if (! in_array($dymoMode, ['A', 'B'], true)) { $dymoMode = 'A'; } $base = url()->current(); $qsBase = [ 'format' => $format, ]; $presetA = $base . '?' . http_build_query(array_merge($qsBase, ['dymo_fix' => 0, 'rot' => 0, 'dx' => $dx, 'dy' => $dy])); $presetB = $base . '?' . http_build_query(array_merge($qsBase, ['dymo_fix' => 0, 'rot' => 90, 'dx' => $dx, 'dy' => $dy])); $presetC = $base . '?' . http_build_query(array_merge($qsBase, ['dymo_fix' => 1, 'rot' => -90, 'dx' => $dx, 'dy' => $dy])); $presetD = $base . '?' . http_build_query(array_merge($qsBase, ['dymo_fix' => 1, 'rot' => 90, 'dx' => $dx, 'dy' => $dy])); $presetC2 = $base . '?' . http_build_query(array_merge($qsBase, ['dymo_fix' => 1, 'dymo_mode' => 'B', 'rot' => -90, 'dx' => $dx, 'dy' => $dy])); $presetD2 = $base . '?' . http_build_query(array_merge($qsBase, ['dymo_fix' => 1, 'dymo_mode' => 'B', 'rot' => 90, 'dx' => $dx, 'dy' => $dy])); $qsCurrent = [ 'format' => $format, 'dymo_fix' => $dymoFix ? 1 : 0, 'dymo_mode' => $dymoMode, 'rot' => $rot, ]; $urlDxDy = function (float $newDx, float $newDy) use ($base, $qsCurrent): string { return $base . '?' . http_build_query(array_merge($qsCurrent, [ 'dx' => number_format($newDx, 2, '.', ''), 'dy' => number_format($newDy, 2, '.', ''), ])); }; $dxPlus05 = $urlDxDy($dx + 0.5, $dy); $dxMinus05 = $urlDxDy($dx - 0.5, $dy); $dyPlus05 = $urlDxDy($dx, $dy + 0.5); $dyMinus05 = $urlDxDy($dx, $dy - 0.5); $dxPlus1 = $urlDxDy($dx + 1.0, $dy); $dxMinus1 = $urlDxDy($dx - 1.0, $dy); $dyPlus1 = $urlDxDy($dx, $dy + 1.0); $dyMinus1 = $urlDxDy($dx, $dy - 1.0); @endphp @if($autoPrint) @endif
Preset A (fix=0 rot=0) Preset B (fix=0 rot=90) Preset C (fix=1 rot=-90) Preset D (fix=1 rot=90) Preset C2 (fix=1 mode=B rot=-90) Preset D2 (fix=1 mode=B rot=90) dx −1 −0.5 +0.5 +1 dy −1 −0.5 +0.5 +1
Nota: se A/B risultano “vuoti” o stampano spostati, usa C/D (fix=1). Se C/D stampano ma risultano troppo a sinistra/destra, correggi con dx/dy.
TOP
LEFT
DYMO {{ $format }} ({{ $w }}×{{ $h }}mm) · fix={{ $dymoFix ? '1' : '0' }} · mode={{ $dymoMode }} · dx={{ number_format($dx, 2, '.', '') }}mm · dy={{ number_format($dy, 2, '.', '') }}mm · rot={{ (int) $rot }}°
Prova rapida 11354: aggiungi ?format=11354&dymo_fix=1 (se ruotata), poi regola dx/dy in mm.