-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #14391 from snipe/features/add_Brother_188mm_tape_…
…label Added Brother 18mm label type
- Loading branch information
Showing
2 changed files
with
75 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<?php | ||
|
||
namespace App\Models\Labels\Tapes\Brother; | ||
|
||
use App\Helpers\Helper; | ||
use App\Models\Labels\Label; | ||
|
||
abstract class TZe_18mm extends Label | ||
{ | ||
private const HEIGHT = 18.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()); } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
<?php | ||
|
||
namespace App\Models\Labels\Tapes\Brother; | ||
|
||
class TZe_18mm_A extends TZe_18mm | ||
{ | ||
private const BARCODE_SIZE = 3.20; | ||
private const BARCODE_MARGIN = 0.30; | ||
private const TEXT_SIZE_MOD = 1.00; | ||
|
||
public function getUnit() { return 'mm'; } | ||
public function getWidth() { return 50.0; } | ||
public function getSupportAssetTag() { return true; } | ||
public function getSupport1DBarcode() { return true; } | ||
public function getSupport2DBarcode() { return false; } | ||
public function getSupportFields() { return 1; } | ||
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 | ||
); | ||
} | ||
|
||
$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 | ||
); | ||
} | ||
|
||
} | ||
} |