From 7939c691f787a554c8468e8dcdace312b899bd80 Mon Sep 17 00:00:00 2001 From: snipe Date: Thu, 7 Mar 2024 22:04:12 +0000 Subject: [PATCH] Added Brother 18mm label type Signed-off-by: snipe --- app/Models/Labels/Tapes/Brother/TZe_18mm.php | 19 +++++++ .../Labels/Tapes/Brother/TZe_18mm_A.php | 56 +++++++++++++++++++ 2 files changed, 75 insertions(+) create mode 100644 app/Models/Labels/Tapes/Brother/TZe_18mm.php create mode 100644 app/Models/Labels/Tapes/Brother/TZe_18mm_A.php diff --git a/app/Models/Labels/Tapes/Brother/TZe_18mm.php b/app/Models/Labels/Tapes/Brother/TZe_18mm.php new file mode 100644 index 0000000000..38c14c7aa4 --- /dev/null +++ b/app/Models/Labels/Tapes/Brother/TZe_18mm.php @@ -0,0 +1,19 @@ +getUnit()); } + public function getMarginTop() { return Helper::convertUnit(self::MARGIN_SIDES, 'mm', $this->getUnit()); } + public function getMarginBottom() { return Helper::convertUnit(self::MARGIN_SIDES, 'mm', $this->getUnit());} + public function getMarginLeft() { return Helper::convertUnit(self::MARGIN_ENDS, 'mm', $this->getUnit()); } + public function getMarginRight() { return Helper::convertUnit(self::MARGIN_ENDS, 'mm', $this->getUnit()); } +} \ No newline at end of file diff --git a/app/Models/Labels/Tapes/Brother/TZe_18mm_A.php b/app/Models/Labels/Tapes/Brother/TZe_18mm_A.php new file mode 100644 index 0000000000..32156f5ee6 --- /dev/null +++ b/app/Models/Labels/Tapes/Brother/TZe_18mm_A.php @@ -0,0 +1,56 @@ +getPrintableArea(); + + if ($record->has('barcode1d')) { + static::write1DBarcode( + $pdf, $record->get('barcode1d')->content, $record->get('barcode1d')->type, + $pa->x1, $pa->y1, $pa->w, self::BARCODE_SIZE + ); + } + + $currentY = $pa->y1 + self::BARCODE_SIZE + self::BARCODE_MARGIN; + $usableHeight = $pa->h - self::BARCODE_SIZE - self::BARCODE_MARGIN; + $fontSize = $usableHeight + self::TEXT_SIZE_MOD; + + $tagWidth = $pa->w / 3; + $fieldWidth = $pa->w / 3 * 2; + + static::writeText( + $pdf, $record->get('tag'), + $pa->x1, $currentY, + 'freemono', 'b', $fontSize, 'L', + $tagWidth, $usableHeight, true, 0, 0 + ); + + if ($record->get('fields')->count() >= 1) { + static::writeText( + $pdf, $record->get('fields')->values()->get(0)['value'], + $pa->x1 + ($tagWidth), $currentY, + 'freemono', 'b', $fontSize, 'R', + $fieldWidth, $usableHeight, true, 0, 0 + ); + } + + } +} \ No newline at end of file