2022-11-01 19:09:11 -07:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Models\Labels\Tapes\Brother;
|
|
|
|
|
|
|
|
class TZe_24mm_A extends TZe_24mm
|
|
|
|
{
|
|
|
|
private const BARCODE_MARGIN = 1.40;
|
2022-11-02 07:38:00 -07:00
|
|
|
private const TAG_SIZE = 2.80;
|
2022-11-01 19:09:11 -07:00
|
|
|
private const TITLE_SIZE = 2.80;
|
2022-11-02 07:38:00 -07:00
|
|
|
private const TITLE_MARGIN = 0.50;
|
|
|
|
private const LABEL_SIZE = 2.00;
|
|
|
|
private const LABEL_MARGIN = - 0.35;
|
2022-11-01 19:09:11 -07:00
|
|
|
private const FIELD_SIZE = 3.20;
|
2022-11-02 07:38:00 -07:00
|
|
|
private const FIELD_MARGIN = 0.15;
|
2022-11-01 19:09:11 -07:00
|
|
|
|
|
|
|
public function getUnit() { return 'mm'; }
|
|
|
|
public function getWidth() { return 65.0; }
|
2022-11-02 07:38:00 -07:00
|
|
|
public function getSupportAssetTag() { return true; }
|
2022-11-01 19:09:11 -07:00
|
|
|
public function getSupport1DBarcode() { return false; }
|
|
|
|
public function getSupport2DBarcode() { return true; }
|
|
|
|
public function getSupportFields() { return 3; }
|
|
|
|
public function getSupportLogo() { return false; }
|
|
|
|
public function getSupportTitle() { return true; }
|
|
|
|
|
|
|
|
public function preparePDF($pdf) {}
|
|
|
|
|
|
|
|
public function write($pdf, $record) {
|
|
|
|
$pa = $this->getPrintableArea();
|
|
|
|
|
2022-11-02 07:38:00 -07:00
|
|
|
$currentX = $pa->x1;
|
|
|
|
$currentY = $pa->y1;
|
|
|
|
$usableWidth = $pa->w;
|
|
|
|
|
|
|
|
$barcodeSize = $pa->h - self::TAG_SIZE;
|
2022-11-01 19:09:11 -07:00
|
|
|
|
|
|
|
if ($record->has('barcode2d')) {
|
2022-11-02 07:38:00 -07:00
|
|
|
static::writeText(
|
|
|
|
$pdf, $record->get('tag'),
|
|
|
|
$pa->x1, $pa->y2 - self::TAG_SIZE,
|
|
|
|
'freemono', 'b', self::TAG_SIZE, 'C',
|
|
|
|
$barcodeSize, self::TAG_SIZE, true, 0
|
|
|
|
);
|
2022-11-01 19:09:11 -07:00
|
|
|
static::write2DBarcode(
|
|
|
|
$pdf, $record->get('barcode2d')->content, $record->get('barcode2d')->type,
|
2022-11-02 07:38:00 -07:00
|
|
|
$currentX, $currentY,
|
|
|
|
$barcodeSize, $barcodeSize
|
|
|
|
);
|
|
|
|
$currentX += $barcodeSize + self::BARCODE_MARGIN;
|
|
|
|
$usableWidth -= $barcodeSize + self::BARCODE_MARGIN;
|
|
|
|
} else {
|
|
|
|
static::writeText(
|
|
|
|
$pdf, $record->get('tag'),
|
|
|
|
$pa->x1, $pa->y2 - self::TAG_SIZE,
|
|
|
|
'freemono', 'b', self::TAG_SIZE, 'R',
|
|
|
|
$usableWidth, self::TAG_SIZE, true, 0
|
2022-11-01 19:09:11 -07:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($record->has('title')) {
|
|
|
|
static::writeText(
|
|
|
|
$pdf, $record->get('title'),
|
2022-11-02 07:38:00 -07:00
|
|
|
$currentX, $currentY,
|
2022-11-01 19:09:11 -07:00
|
|
|
'freesans', '', self::TITLE_SIZE, 'L',
|
2022-11-02 07:38:00 -07:00
|
|
|
$usableWidth, self::TITLE_SIZE, true, 0
|
2022-11-01 19:09:11 -07:00
|
|
|
);
|
2022-11-02 07:38:00 -07:00
|
|
|
$currentY += self::TITLE_SIZE + self::TITLE_MARGIN;
|
2022-11-01 19:09:11 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
foreach ($record->get('fields') as $label => $value) {
|
|
|
|
static::writeText(
|
|
|
|
$pdf, $label,
|
2022-11-02 07:38:00 -07:00
|
|
|
$currentX, $currentY,
|
2022-11-01 19:09:11 -07:00
|
|
|
'freesans', '', self::LABEL_SIZE, 'L',
|
2022-11-02 07:38:00 -07:00
|
|
|
$usableWidth, self::LABEL_SIZE, true, 0, 0
|
2022-11-01 19:09:11 -07:00
|
|
|
);
|
2022-11-02 07:38:00 -07:00
|
|
|
$currentY += self::LABEL_SIZE + self::LABEL_MARGIN;
|
2022-11-01 19:09:11 -07:00
|
|
|
|
|
|
|
static::writeText(
|
|
|
|
$pdf, $value,
|
2022-11-02 07:38:00 -07:00
|
|
|
$currentX, $currentY,
|
2022-11-01 19:09:11 -07:00
|
|
|
'freemono', 'B', self::FIELD_SIZE, 'L',
|
2022-11-02 07:38:00 -07:00
|
|
|
$usableWidth, self::FIELD_SIZE, true, 0, 0.3
|
2022-11-01 19:09:11 -07:00
|
|
|
);
|
2022-11-02 07:38:00 -07:00
|
|
|
$currentY += self::FIELD_SIZE + self::FIELD_MARGIN;
|
2022-11-01 19:09:11 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|