From 61bc570d5958b87ec6305ddbf0804dbe9daaf4dd Mon Sep 17 00:00:00 2001 From: Godfrey M Date: Tue, 20 Jan 2026 15:59:40 -0800 Subject: [PATCH 1/7] add title to layout helper, update lw2112283 --- app/Helpers/Helper.php | 23 ++++++++-- .../Labels/Tapes/Dymo/LabelWriter_2112283.php | 46 +++++++++++-------- 2 files changed, 46 insertions(+), 23 deletions(-) diff --git a/app/Helpers/Helper.php b/app/Helpers/Helper.php index 7e44c29adb23..46551bc84cee 100644 --- a/app/Helpers/Helper.php +++ b/app/Helpers/Helper.php @@ -1757,18 +1757,26 @@ static public function labelFieldLayoutScaling( float $baseLabelSize, float $baseFieldSize, float $baseFieldMargin, + ?string $title = null, + float $baseTitleSize = 0.0, + float $baseTitleMargin = 0.0, float $baseLabelPadding = 1.5, float $baseGap = 1.5, float $maxScale = 1.8, string $labelFont = 'freesans', + ) : array { $fieldCount = count($fields); $perFieldHeight = max($baseLabelSize, $baseFieldSize) + $baseFieldMargin; - $baseHeight = $fieldCount * $perFieldHeight; + $baseFieldsHeight = $fieldCount * $perFieldHeight; + + $hasTitle = is_string($title) && trim($title) !== ''; + $baseTitleHeight = $hasTitle ? ($baseTitleSize + $baseTitleMargin) : 0.0; + $baseTotalHeight = $baseTitleHeight + $baseFieldsHeight; $scale = 1.0; - if ($baseHeight > 0 && $usableHeight > 0) { - $scale = $usableHeight / $baseHeight; + if ($baseTotalHeight > 0 && $usableHeight > 0) { + $scale = $usableHeight / $baseTotalHeight; } $scale = min($scale, $maxScale); @@ -1778,6 +1786,10 @@ static public function labelFieldLayoutScaling( $fieldMargin = $baseFieldMargin * $scale; $rowAdvance = max($labelSize, $fieldSize) + $fieldMargin; + $titleSize = $hasTitle ? ($baseTitleSize * $scale) : 0.0; + $titleMargin = $hasTitle ? ($baseTitleMargin * $scale) : 0.0; + $titleAdvance = $hasTitle ? ($titleSize + $titleMargin) : 0.0; + $pdf->SetFont($labelFont, '', $baseLabelSize); $maxLabelWidthPerUnit = 0; @@ -1796,6 +1808,11 @@ static public function labelFieldLayoutScaling( return compact( 'scale', + 'hasTitle', + 'scale', + 'titleSize', + 'titleMargin', + 'titleAdvance', 'labelSize', 'fieldSize', 'fieldMargin', diff --git a/app/Models/Labels/Tapes/Dymo/LabelWriter_2112283.php b/app/Models/Labels/Tapes/Dymo/LabelWriter_2112283.php index 3fc91912e2ed..d7dde401b94d 100644 --- a/app/Models/Labels/Tapes/Dymo/LabelWriter_2112283.php +++ b/app/Models/Labels/Tapes/Dymo/LabelWriter_2112283.php @@ -83,27 +83,20 @@ public function write($pdf, $record) $usableWidth -= $barcodeSize + self::BARCODE_MARGIN; } - if ($record->has('title')) { - static::writeText( - $pdf, $record->get('title'), - $currentX, $currentY, - 'freesans', 'b', self::TITLE_SIZE, 'L', - $usableWidth, self::TITLE_SIZE, true, 0 - ); - $currentY += self::TITLE_SIZE + self::TITLE_MARGIN; - } - + $title = $record->has('title') ? $record->get('title') : null; $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. + $maxFields = $this->getSupportFields(); + $fields = collect($fields); + if ($title) { + $maxFields = max(0, $maxFields - 1); // title consumes one row’s worth of space + } - // Figure out how tall the label fields wants to be - $fieldCount = count($fields); + $fields = $fields->take($maxFields)->values(); $usableHeight = $pa->h - self::TAG_SIZE // bottom tag text - self::BARCODE_MARGIN; // gap between fields and 1D + $field_layout = Helper::labelFieldLayoutScaling( pdf: $pdf, fields: $fields, @@ -113,29 +106,42 @@ public function write($pdf, $record) baseLabelSize: self::LABEL_SIZE, baseFieldSize: self::FIELD_SIZE, baseFieldMargin: self::FIELD_MARGIN, + title: $title, + baseTitleSize: self::TITLE_SIZE, + baseTitleMargin: self::TITLE_MARGIN, baseLabelPadding: 1.5, baseGap: 1.5, maxScale: 1.8, labelFont: 'freesans', ); + extract($field_layout); + if ($hasTitle) { + static::writeText( + $pdf, $title, + $currentX, $currentY, + 'freesans', 'b', $titleSize, 'L', + $usableWidth, $titleSize, true, 0 + ); + $currentY += $titleAdvance; + } foreach ($fields as $field) { $labelText = rtrim($field['label'], ':') . ':'; static::writeText( $pdf, $labelText, $currentX, $currentY, - 'freesans', '', $field_layout['labelSize'], 'L', - $field_layout['labelWidth'], $field_layout['rowAdvance'], true, 0 + 'freesans', '', $labelSize, 'L', + $labelWidth, $rowAdvance, true, 0 ); static::writeText( $pdf, $field['value'], $field_layout['valueX'], $currentY, - 'freemono', 'B', $field_layout['fieldSize'], 'L', - $field_layout['valueWidth'], $field_layout['rowAdvance'], true, 0, 0.01 + 'freemono', 'B', $fieldSize, 'L', + $valueWidth, $rowAdvance, true, 0, 0.01 ); - $currentY += $field_layout['rowAdvance']; + $currentY += $rowAdvance; } if ($record->has('barcode1d')) { static::write1DBarcode( From 66d85d17d954d70a923a2ed11663ab1092333f2b Mon Sep 17 00:00:00 2001 From: Godfrey M Date: Tue, 20 Jan 2026 16:00:24 -0800 Subject: [PATCH 2/7] update LW 1933081 --- .../Labels/Tapes/Dymo/LabelWriter_1933081.php | 42 ++++++++++++------- 1 file changed, 27 insertions(+), 15 deletions(-) diff --git a/app/Models/Labels/Tapes/Dymo/LabelWriter_1933081.php b/app/Models/Labels/Tapes/Dymo/LabelWriter_1933081.php index bba3c992dc70..fd988a0f7919 100644 --- a/app/Models/Labels/Tapes/Dymo/LabelWriter_1933081.php +++ b/app/Models/Labels/Tapes/Dymo/LabelWriter_1933081.php @@ -81,19 +81,18 @@ public function write($pdf, $record) ); $currentX += $barcodeSize + self::BARCODE_MARGIN; $usableWidth -= $barcodeSize + self::BARCODE_MARGIN; - } - - if ($record->has('title')) { - static::writeText( - $pdf, $record->get('title'), - $currentX, $currentY, - 'freesans', 'b', self::TITLE_SIZE, 'L', - $usableWidth, self::TITLE_SIZE, true, 0 - ); - $currentY += self::TITLE_SIZE + self::TITLE_MARGIN; } + $title = $record->has('title') ? $record->get('title') : null; $fields = $record->get('fields'); + $maxFields = $this->getSupportFields(); + $fields = collect($fields); + if ($title) { + $maxFields = max(0, $maxFields - 1); // title consumes one row’s worth of space + } + + $fields = $fields->take($maxFields)->values(); + $usableHeight = $pa->h - self::TAG_SIZE // bottom tag text - self::BARCODE_MARGIN; // gap between fields and 1D @@ -107,29 +106,42 @@ public function write($pdf, $record) baseLabelSize: self::LABEL_SIZE, baseFieldSize: self::FIELD_SIZE, baseFieldMargin: self::FIELD_MARGIN, + title: $title, + baseTitleSize: self::TITLE_SIZE, + baseTitleMargin: self::TITLE_MARGIN, baseLabelPadding: 1.5, baseGap: 1.5, maxScale: 1.8, labelFont: 'freesans', ); + extract($field_layout); + if ($hasTitle) { + static::writeText( + $pdf, $title, + $currentX, $currentY, + 'freesans', 'b', $titleSize, 'L', + $usableWidth, $titleSize, true, 0 + ); + $currentY += $titleAdvance; + } foreach ($fields as $field) { $labelText = rtrim($field['label'], ':') . ':'; static::writeText( $pdf, $labelText, $currentX, $currentY, - 'freesans', '', $field_layout['labelSize'], 'L', - $field_layout['labelWidth'], $field_layout['rowAdvance'], true, 0 + 'freesans', '', $labelSize, 'L', + $labelWidth, $rowAdvance, true, 0 ); static::writeText( $pdf, $field['value'], $field_layout['valueX'], $currentY, - 'freemono', 'B', $field_layout['fieldSize'], 'L', - $field_layout['valueWidth'], $field_layout['rowAdvance'], true, 0, 0.01 + 'freemono', 'B', $fieldSize, 'L', + $valueWidth, $rowAdvance, true, 0, 0.01 ); - $currentY += $field_layout['rowAdvance']; + $currentY += $rowAdvance; } if ($record->has('barcode1d')) { From 2e122fa8d89001b8f4b99a6e6d0ab844b5e7ca56 Mon Sep 17 00:00:00 2001 From: Godfrey M Date: Tue, 20 Jan 2026 16:00:56 -0800 Subject: [PATCH 3/7] update LW 11354 --- .../Labels/Tapes/Dymo/LabelWriter_11354.php | 47 +++++++++++++------ 1 file changed, 32 insertions(+), 15 deletions(-) diff --git a/app/Models/Labels/Tapes/Dymo/LabelWriter_11354.php b/app/Models/Labels/Tapes/Dymo/LabelWriter_11354.php index f913acac3ae8..379ec8f326b9 100644 --- a/app/Models/Labels/Tapes/Dymo/LabelWriter_11354.php +++ b/app/Models/Labels/Tapes/Dymo/LabelWriter_11354.php @@ -96,17 +96,19 @@ public function write($pdf, $record) } // Right column - if ($record->has('title')) { - static::writeText( - $pdf, $record->get('title'), - $currentX, $currentY, - 'freesans', 'b', self::TITLE_SIZE, 'L', - $usableWidth, self::TITLE_SIZE, true, 0 - ); - $currentY += self::TITLE_SIZE + self::TITLE_MARGIN; + $title = $record->has('title') ? $record->get('title') : null; + $fields = $record->get('fields'); + $maxFields = $this->getSupportFields(); + $fields = collect($fields); + if ($title) { + $maxFields = max(0, $maxFields - 1); // title consumes one row’s worth of space } - $fields = $record->get('fields'); + $fields = $fields->take($maxFields)->values(); + + $usableHeight = $pa->h + - self::TAG_SIZE // bottom tag text + - self::BARCODE_MARGIN; // gap between fields and 1D $field_layout = Helper::labelFieldLayoutScaling( pdf: $pdf, @@ -117,27 +119,42 @@ public function write($pdf, $record) baseLabelSize: self::LABEL_SIZE, baseFieldSize: self::FIELD_SIZE, baseFieldMargin: self::FIELD_MARGIN, + title: $title, + baseTitleSize: self::TITLE_SIZE, + baseTitleMargin: self::TITLE_MARGIN, baseLabelPadding: 1.5, baseGap: 1.5, maxScale: 1.8, labelFont: 'freesans', ); + extract($field_layout); + if ($hasTitle) { + static::writeText( + $pdf, $title, + $currentX, $currentY, + 'freesans', 'b', $titleSize, 'L', + $usableWidth, $titleSize, true, 0 + ); + $currentY += $titleAdvance; + } foreach ($fields as $field) { + $labelText = rtrim($field['label'], ':') . ':'; + static::writeText( - $pdf, $field['label'], + $pdf, $labelText, $currentX, $currentY, - 'freesans', '', $field_layout['labelSize'], 'L', - $field_layout['labelWidth'], $field_layout['rowAdvance'], true, 0 + 'freesans', '', $labelSize, 'L', + $labelWidth, $rowAdvance, true, 0 ); static::writeText( $pdf, $field['value'], $field_layout['valueX'], $currentY, - 'freemono', 'B', $field_layout['fieldSize'], 'L', - $field_layout['valueWidth'], $field_layout['rowAdvance'], true, 0, 0.01 + 'freemono', 'B', $fieldSize, 'L', + $valueWidth, $rowAdvance, true, 0, 0.01 ); - $currentY += $field_layout['rowAdvance']; + $currentY += $rowAdvance; } } From fd39c8bf116924acf260cd54ef117288db142284 Mon Sep 17 00:00:00 2001 From: Godfrey M Date: Tue, 20 Jan 2026 16:09:04 -0800 Subject: [PATCH 4/7] update title help text --- resources/lang/en-US/admin/settings/general.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/lang/en-US/admin/settings/general.php b/resources/lang/en-US/admin/settings/general.php index 1ea8d6498c04..35a27962129d 100644 --- a/resources/lang/en-US/admin/settings/general.php +++ b/resources/lang/en-US/admin/settings/general.php @@ -387,7 +387,7 @@ 'label2_template' => 'Template', 'label2_template_help' => 'Select which template to use for label generation', 'label2_title' => 'Title', - 'label2_title_help' => 'The title to show on labels that support it', + 'label2_title_help' => 'The title to show on labels that support it.
This will occupy the first Label Field row.', 'label2_title_help_phold' => 'The placeholder {COMPANY} will be replaced with the asset's company name', 'label2_asset_logo' => 'Use Asset Logo', 'label2_asset_logo_help' => 'Use the logo of the asset's assigned company, rather than the value at :setting_name', From 3718ce9749b626464f7bba8ce5acbfb654015a5c Mon Sep 17 00:00:00 2001 From: Godfrey M Date: Tue, 20 Jan 2026 16:18:13 -0800 Subject: [PATCH 5/7] if label is null make room for value --- app/Helpers/Helper.php | 6 ++++++ .../Labels/Tapes/Dymo/LabelWriter_11354.php | 16 ++++++++++++++++ .../Labels/Tapes/Dymo/LabelWriter_1933081.php | 16 ++++++++++++++++ .../Labels/Tapes/Dymo/LabelWriter_2112283.php | 16 ++++++++++++++++ 4 files changed, 54 insertions(+) diff --git a/app/Helpers/Helper.php b/app/Helpers/Helper.php index 46551bc84cee..dc5e5ac3b7f2 100644 --- a/app/Helpers/Helper.php +++ b/app/Helpers/Helper.php @@ -1794,6 +1794,12 @@ static public function labelFieldLayoutScaling( $maxLabelWidthPerUnit = 0; foreach ($fields as $field) { + $rawLabel = $field['label'] ?? null; + + // If no label, do not include it in label-column sizing + if (!is_string($rawLabel) || trim($rawLabel) === '') { + continue; + } $label = rtrim($field['label'], ':') . ':'; $width = $pdf->GetStringWidth($label); $maxLabelWidthPerUnit = max($maxLabelWidthPerUnit, $width / $baseLabelSize); diff --git a/app/Models/Labels/Tapes/Dymo/LabelWriter_11354.php b/app/Models/Labels/Tapes/Dymo/LabelWriter_11354.php index 379ec8f326b9..edbdb99d9f2b 100644 --- a/app/Models/Labels/Tapes/Dymo/LabelWriter_11354.php +++ b/app/Models/Labels/Tapes/Dymo/LabelWriter_11354.php @@ -139,6 +139,22 @@ public function write($pdf, $record) $currentY += $titleAdvance; } foreach ($fields as $field) { + $rawLabel = $field['label'] ?? null; + $value = (string)($field['value'] ?? ''); + + // No label: value takes the whole row + if (!is_string($rawLabel) || trim($rawLabel) === '') { + static::writeText( + $pdf, $value, + $currentX, $currentY, + 'freemono', 'B', $fieldSize, 'L', + $usableWidth, $rowAdvance, true, 0, 0.01 + ); + + $currentY += $rowAdvance; + continue; + } + $labelText = rtrim($field['label'], ':') . ':'; static::writeText( diff --git a/app/Models/Labels/Tapes/Dymo/LabelWriter_1933081.php b/app/Models/Labels/Tapes/Dymo/LabelWriter_1933081.php index fd988a0f7919..f69ba44889f0 100644 --- a/app/Models/Labels/Tapes/Dymo/LabelWriter_1933081.php +++ b/app/Models/Labels/Tapes/Dymo/LabelWriter_1933081.php @@ -126,6 +126,22 @@ public function write($pdf, $record) $currentY += $titleAdvance; } foreach ($fields as $field) { + $rawLabel = $field['label'] ?? null; + $value = (string)($field['value'] ?? ''); + + // No label: value takes the whole row + if (!is_string($rawLabel) || trim($rawLabel) === '') { + static::writeText( + $pdf, $value, + $currentX, $currentY, + 'freemono', 'B', $fieldSize, 'L', + $usableWidth, $rowAdvance, true, 0, 0.01 + ); + + $currentY += $rowAdvance; + continue; + } + $labelText = rtrim($field['label'], ':') . ':'; static::writeText( diff --git a/app/Models/Labels/Tapes/Dymo/LabelWriter_2112283.php b/app/Models/Labels/Tapes/Dymo/LabelWriter_2112283.php index d7dde401b94d..5a8d154461b1 100644 --- a/app/Models/Labels/Tapes/Dymo/LabelWriter_2112283.php +++ b/app/Models/Labels/Tapes/Dymo/LabelWriter_2112283.php @@ -126,6 +126,22 @@ public function write($pdf, $record) $currentY += $titleAdvance; } foreach ($fields as $field) { + $rawLabel = $field['label'] ?? null; + $value = (string)($field['value'] ?? ''); + + // No label: value takes the whole row + if (!is_string($rawLabel) || trim($rawLabel) === '') { + static::writeText( + $pdf, $value, + $currentX, $currentY, + 'freemono', 'B', $fieldSize, 'L', + $usableWidth, $rowAdvance, true, 0, 0.01 + ); + + $currentY += $rowAdvance; + continue; + } + $labelText = rtrim($field['label'], ':') . ':'; static::writeText( From 10cfe6d37a6f7a2ec48dc5017b7a7ae7cae2767d Mon Sep 17 00:00:00 2001 From: Godfrey M Date: Tue, 20 Jan 2026 16:23:36 -0800 Subject: [PATCH 6/7] remove duplicate parameter --- app/Helpers/Helper.php | 1 - 1 file changed, 1 deletion(-) diff --git a/app/Helpers/Helper.php b/app/Helpers/Helper.php index dc5e5ac3b7f2..5f13f13f3f3a 100644 --- a/app/Helpers/Helper.php +++ b/app/Helpers/Helper.php @@ -1815,7 +1815,6 @@ static public function labelFieldLayoutScaling( return compact( 'scale', 'hasTitle', - 'scale', 'titleSize', 'titleMargin', 'titleAdvance', From 1dab36da2d811126c3871e5c8e02c177eeaea89f Mon Sep 17 00:00:00 2001 From: Godfrey M Date: Wed, 21 Jan 2026 10:32:26 -0800 Subject: [PATCH 7/7] replaced extracted variables with array --- .../Labels/Tapes/Dymo/LabelWriter_11354.php | 25 +++++++++---------- .../Labels/Tapes/Dymo/LabelWriter_1933081.php | 25 +++++++++---------- .../Labels/Tapes/Dymo/LabelWriter_2112283.php | 25 +++++++++---------- 3 files changed, 36 insertions(+), 39 deletions(-) diff --git a/app/Models/Labels/Tapes/Dymo/LabelWriter_11354.php b/app/Models/Labels/Tapes/Dymo/LabelWriter_11354.php index edbdb99d9f2b..50957f446bb5 100644 --- a/app/Models/Labels/Tapes/Dymo/LabelWriter_11354.php +++ b/app/Models/Labels/Tapes/Dymo/LabelWriter_11354.php @@ -127,16 +127,15 @@ public function write($pdf, $record) maxScale: 1.8, labelFont: 'freesans', ); - extract($field_layout); - if ($hasTitle) { + if ($field_layout['hasTitle']) { static::writeText( $pdf, $title, $currentX, $currentY, - 'freesans', 'b', $titleSize, 'L', - $usableWidth, $titleSize, true, 0 + 'freesans', 'b', $field_layout['titleSize'], 'L', + $usableWidth, $field_layout['titleSize'], true, 0 ); - $currentY += $titleAdvance; + $currentY += $field_layout['titleAdvance']; } foreach ($fields as $field) { $rawLabel = $field['label'] ?? null; @@ -147,11 +146,11 @@ public function write($pdf, $record) static::writeText( $pdf, $value, $currentX, $currentY, - 'freemono', 'B', $fieldSize, 'L', - $usableWidth, $rowAdvance, true, 0, 0.01 + 'freemono', 'B', $field_layout['fieldSize'], 'L', + $usableWidth, $field_layout['rowAdvance'], true, 0, 0.01 ); - $currentY += $rowAdvance; + $currentY += $field_layout['rowAdvance']; continue; } @@ -160,17 +159,17 @@ public function write($pdf, $record) static::writeText( $pdf, $labelText, $currentX, $currentY, - 'freesans', '', $labelSize, 'L', - $labelWidth, $rowAdvance, true, 0 + 'freesans', '', $field_layout['labelSize'], 'L', + $field_layout['labelWidth'], $field_layout['rowAdvance'], true, ); static::writeText( $pdf, $field['value'], $field_layout['valueX'], $currentY, - 'freemono', 'B', $fieldSize, 'L', - $valueWidth, $rowAdvance, true, 0, 0.01 + 'freemono', 'B', $field_layout['fieldSize'], 'L', + $field_layout['valueWidth'], $field_layout['rowAdvance'], true, 0, 0.01 ); - $currentY += $rowAdvance; + $currentY += $field_layout['rowAdvance'];; } } diff --git a/app/Models/Labels/Tapes/Dymo/LabelWriter_1933081.php b/app/Models/Labels/Tapes/Dymo/LabelWriter_1933081.php index f69ba44889f0..c84bdd82997f 100644 --- a/app/Models/Labels/Tapes/Dymo/LabelWriter_1933081.php +++ b/app/Models/Labels/Tapes/Dymo/LabelWriter_1933081.php @@ -114,16 +114,15 @@ public function write($pdf, $record) maxScale: 1.8, labelFont: 'freesans', ); - extract($field_layout); - if ($hasTitle) { + if ($field_layout['hasTitle']) { static::writeText( $pdf, $title, $currentX, $currentY, - 'freesans', 'b', $titleSize, 'L', - $usableWidth, $titleSize, true, 0 + 'freesans', 'b', $field_layout['titleSize'], 'L', + $usableWidth, $field_layout['titleSize'], true, 0 ); - $currentY += $titleAdvance; + $currentY += $field_layout['titleAdvance']; } foreach ($fields as $field) { $rawLabel = $field['label'] ?? null; @@ -134,11 +133,11 @@ public function write($pdf, $record) static::writeText( $pdf, $value, $currentX, $currentY, - 'freemono', 'B', $fieldSize, 'L', - $usableWidth, $rowAdvance, true, 0, 0.01 + 'freemono', 'B', $field_layout['fieldSize'], 'L', + $usableWidth, $field_layout['rowAdvance'], true, 0, 0.01 ); - $currentY += $rowAdvance; + $currentY += $field_layout['rowAdvance']; continue; } @@ -147,17 +146,17 @@ public function write($pdf, $record) static::writeText( $pdf, $labelText, $currentX, $currentY, - 'freesans', '', $labelSize, 'L', - $labelWidth, $rowAdvance, true, 0 + 'freesans', '', $field_layout['labelSize'], 'L', + $field_layout['labelWidth'], $field_layout['rowAdvance'], true, ); static::writeText( $pdf, $field['value'], $field_layout['valueX'], $currentY, - 'freemono', 'B', $fieldSize, 'L', - $valueWidth, $rowAdvance, true, 0, 0.01 + 'freemono', 'B', $field_layout['fieldSize'], 'L', + $field_layout['valueWidth'], $field_layout['rowAdvance'], true, 0, 0.01 ); - $currentY += $rowAdvance; + $currentY += $field_layout['rowAdvance'];; } if ($record->has('barcode1d')) { diff --git a/app/Models/Labels/Tapes/Dymo/LabelWriter_2112283.php b/app/Models/Labels/Tapes/Dymo/LabelWriter_2112283.php index 5a8d154461b1..305693ea74f2 100644 --- a/app/Models/Labels/Tapes/Dymo/LabelWriter_2112283.php +++ b/app/Models/Labels/Tapes/Dymo/LabelWriter_2112283.php @@ -114,16 +114,15 @@ public function write($pdf, $record) maxScale: 1.8, labelFont: 'freesans', ); - extract($field_layout); - if ($hasTitle) { + if ($field_layout['hasTitle']) { static::writeText( $pdf, $title, $currentX, $currentY, - 'freesans', 'b', $titleSize, 'L', - $usableWidth, $titleSize, true, 0 + 'freesans', 'b', $field_layout['titleSize'], 'L', + $usableWidth, $field_layout['titleSize'], true, 0 ); - $currentY += $titleAdvance; + $currentY += $field_layout['titleAdvance']; } foreach ($fields as $field) { $rawLabel = $field['label'] ?? null; @@ -134,11 +133,11 @@ public function write($pdf, $record) static::writeText( $pdf, $value, $currentX, $currentY, - 'freemono', 'B', $fieldSize, 'L', - $usableWidth, $rowAdvance, true, 0, 0.01 + 'freemono', 'B', $field_layout['fieldSize'], 'L', + $usableWidth, $field_layout['rowAdvance'], true, 0, 0.01 ); - $currentY += $rowAdvance; + $currentY += $field_layout['rowAdvance']; continue; } @@ -147,17 +146,17 @@ public function write($pdf, $record) static::writeText( $pdf, $labelText, $currentX, $currentY, - 'freesans', '', $labelSize, 'L', - $labelWidth, $rowAdvance, true, 0 + 'freesans', '', $field_layout['labelSize'], 'L', + $field_layout['labelWidth'], $field_layout['rowAdvance'], true, ); static::writeText( $pdf, $field['value'], $field_layout['valueX'], $currentY, - 'freemono', 'B', $fieldSize, 'L', - $valueWidth, $rowAdvance, true, 0, 0.01 + 'freemono', 'B', $field_layout['fieldSize'], 'L', + $field_layout['valueWidth'], $field_layout['rowAdvance'], true, 0, 0.01 ); - $currentY += $rowAdvance; + $currentY += $field_layout['rowAdvance'];; } if ($record->has('barcode1d')) { static::write1DBarcode(