A free open source IT asset/license management system
Add P-touch TZe 12mm Tape Example
Cram42a60ee7736b67
diff --git a/app/Models/Labels/Tapes/Brother/TZe_12mm.php b/app/Models/Labels/Tapes/Brother/TZe_12mm.phpnew file mode 100644index 0000000000..f9196847ce--- /dev/null+++ b/app/Models/Labels/Tapes/Brother/TZe_12mm.php@@ -0,0 +1,19 @@+<?php++namespace App\Models\Labels\Tapes\Brother;++use App\Helpers\Helper;+use App\Models\Labels\Label;++abstract class TZe_12mm extends Label+{+ private const HEIGHT = 12.00;+ private const MARGIN_SIDES = 3.20;+ private const MARGIN_ENDS = 3.20;++ public function getHeight() { return Helper::convertUnit(self::HEIGHT, 'mm', $this->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 filediff --git a/app/Models/Labels/Tapes/Brother/TZe_12mm_A.php b/app/Models/Labels/Tapes/Brother/TZe_12mm_A.phpnew file mode 100644index 0000000000..060ab3cb83--- /dev/null+++ b/app/Models/Labels/Tapes/Brother/TZe_12mm_A.php@@ -0,0 +1,54 @@+<?php++namespace App\Models\Labels\Tapes\Brother;++class TZe_12mm_A extends TZe_12mm+{+ private const BARCODE_SIZE = 2.50;+ private const BARCODE_MARGIN = 0.30;+ private const FIELD_SIZE_MOD = 1.00;++ public function getUnit() { return 'mm'; }+ public function getWidth() { return 50.0; }+ public function getSupport1DBarcode() { return true; }+ public function getSupport2DBarcode() { return false; }+ public function getSupportFields() { return 2; }+ public function getSupportLogo() { return false; }+ public function getSupportTitle() { return false; }++ public function preparePDF($pdf) {}++ public function write($pdf, $record) {+ $pa = $this->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+ );+ }++ $fields = $record->get('fields');+ $y = $pa->y1 + self::BARCODE_SIZE + self::BARCODE_MARGIN;+ $realSize = $pa->h - self::BARCODE_SIZE - self::BARCODE_MARGIN;+ $fontSize = $realSize + self::FIELD_SIZE_MOD;++ if ($fields->count() >= 1) {+ static::writeText(+ $pdf, $fields->values()->get(0),+ $pa->x1, $y,+ 'freemono', 'B', $fontSize, 'L',+ $pa->w, $realSize, true, 0, 0.1+ );+ }+ if ($fields->count() >= 2) {+ static::writeText(+ $pdf, $fields->values()->get(1),+ $pa->x1, $y,+ 'freemono', 'B', $fontSize, 'R',+ $pa->w, $realSize, true, 0, 0.1+ );+ }++ }+}\ No newline at end of file