A free open source IT asset/license management system
applied to LabelWriter_11354
Godfrey Md96d0b1bcb05
diff --git a/app/Models/Labels/Tapes/Dymo/LabelWriter_11354.php b/app/Models/Labels/Tapes/Dymo/LabelWriter_11354.phpindex 60c311e2b7..f913acac3a 100644--- a/app/Models/Labels/Tapes/Dymo/LabelWriter_11354.php+++ b/app/Models/Labels/Tapes/Dymo/LabelWriter_11354.php@@ -3,6 +3,8 @@namespace App\Models\Labels\Tapes\Dymo;+use App\Helpers\Helper;+class LabelWriter_11354 extends LabelWriter{private const BARCODE1D_HEIGHT = 3.00;@@ -105,46 +107,37 @@ class LabelWriter_11354 extends LabelWriter}$fields = $record->get('fields');- // Below rescales the size of the field box to fit, it feels like it could/should be abstracted one class above- // to be usable on other labels but im unsure of how to implement that, since it uses a lot of private- // constants.-- // Figure out how tall the label fields wants to be- $fieldCount = count($fields);- $perFieldHeight = (self::LABEL_SIZE + self::LABEL_MARGIN)- + (self::FIELD_SIZE + self::FIELD_MARGIN);- $usableHeight = $pa->h- - self::TAG_SIZE- - self::BARCODE_MARGIN;- $baseHeight = $fieldCount * $perFieldHeight;- // If it doesn't fit in the available height, scale everything down- $scale = 1.0;- if ($baseHeight > $usableHeight && $baseHeight > 0) {- $scale = $usableHeight / $baseHeight;- }-- $labelSize = self::LABEL_SIZE * $scale;- $labelMargin = self::LABEL_MARGIN * $scale;- $fieldSize = self::FIELD_SIZE * $scale;- $fieldMargin = self::FIELD_MARGIN * $scale;+ $field_layout = Helper::labelFieldLayoutScaling(+ pdf: $pdf,+ fields: $fields,+ currentX: $currentX,+ usableWidth: $usableWidth,+ usableHeight: $usableHeight,+ baseLabelSize: self::LABEL_SIZE,+ baseFieldSize: self::FIELD_SIZE,+ baseFieldMargin: self::FIELD_MARGIN,+ baseLabelPadding: 1.5,+ baseGap: 1.5,+ maxScale: 1.8,+ labelFont: 'freesans',+ );foreach ($fields as $field) {static::writeText($pdf, $field['label'],$currentX, $currentY,- 'freesans', '', $labelSize, 'L',- $usableWidth, $labelSize, true, 0+ 'freesans', '', $field_layout['labelSize'], 'L',+ $field_layout['labelWidth'], $field_layout['rowAdvance'], true, 0);- $currentY += $labelSize + $labelMargin;static::writeText($pdf, $field['value'],- $currentX, $currentY,- 'freemono', 'B', $fieldSize, 'L',- $usableWidth, $fieldSize, true, 0, 0.01+ $field_layout['valueX'], $currentY,+ 'freemono', 'B', $field_layout['fieldSize'], 'L',+ $field_layout['valueWidth'], $field_layout['rowAdvance'], true, 0, 0.01);- $currentY += $fieldSize + $fieldMargin;+ $currentY += $field_layout['rowAdvance'];}}