1+ <?php
2+
3+ namespace App \Models \Labels \Sheets \Avery ;
4+
5+
6+ class _3490_A extends _3490
7+ {
8+ private const BARCODE_MARGIN = 0.075 ;
9+ private const TAG_SIZE = 0.125 ;
10+ private const TITLE_SIZE = 0.140 ;
11+ private const TITLE_MARGIN = 0.040 ;
12+ private const LABEL_SIZE = 0.090 ;
13+ private const LABEL_MARGIN = -0.015 ;
14+ private const FIELD_SIZE = 0.150 ;
15+ private const FIELD_MARGIN = 0.012 ;
16+
17+ public function getUnit () { return 'in ' ; }
18+
19+ public function getLabelMarginTop () { return 0.06 ; }
20+ public function getLabelMarginBottom () { return 0.06 ; }
21+ public function getLabelMarginLeft () { return 0.06 ; }
22+ public function getLabelMarginRight () { return 0.06 ; }
23+
24+ public function getSupportAssetTag () { return false ; }
25+ public function getSupport1DBarcode () { return false ; }
26+ public function getSupport2DBarcode () { return true ; }
27+ public function getSupportFields () { return 3 ; }
28+ public function getSupportLogo () { return false ; }
29+ public function getSupportTitle () { return true ; }
30+
31+ public function preparePDF ($ pdf ) {}
32+
33+ public function write ($ pdf , $ record ) {
34+ $ pa = $ this ->getLabelPrintableArea ();
35+
36+ $ currentX = $ pa ->x1 ;
37+ $ currentY = $ pa ->y1 ;
38+ $ usableWidth = $ pa ->w ;
39+ $ usableHeight = $ pa ->h ;
40+
41+ if ($ record ->has ('title ' )) {
42+ static ::writeText (
43+ $ pdf , $ record ->get ('title ' ),
44+ $ pa ->x1 , $ pa ->y1 ,
45+ 'freesans ' , '' , self ::TITLE_SIZE , 'C ' ,
46+ $ pa ->w , self ::TITLE_SIZE , true , 0
47+ );
48+ $ currentY += self ::TITLE_SIZE + self ::TITLE_MARGIN ;
49+ $ usableHeight -= self ::TITLE_SIZE + self ::TITLE_MARGIN ;
50+ }
51+
52+ $ barcodeSize = $ usableHeight ;
53+ if ($ record ->has ('barcode2d ' )) {
54+ static ::write2DBarcode (
55+ $ pdf , $ record ->get ('barcode2d ' )->content , $ record ->get ('barcode2d ' )->type ,
56+ $ currentX , $ currentY ,
57+ $ barcodeSize , $ barcodeSize
58+ );
59+ $ currentX += $ barcodeSize + self ::BARCODE_MARGIN ;
60+ $ usableWidth -= $ barcodeSize + self ::BARCODE_MARGIN ;
61+ }
62+
63+ foreach ($ record ->get ('fields ' ) as $ field ) {
64+ static ::writeText (
65+ $ pdf , $ field ['label ' ],
66+ $ currentX , $ currentY ,
67+ 'freesans ' , '' , self ::LABEL_SIZE , 'L ' ,
68+ $ usableWidth , self ::LABEL_SIZE , true , 0
69+ );
70+ $ currentY += self ::LABEL_SIZE + self ::LABEL_MARGIN ;
71+
72+ static ::writeText (
73+ $ pdf , $ field ['value ' ],
74+ $ currentX , $ currentY ,
75+ 'freemono ' , 'B ' , self ::FIELD_SIZE , 'L ' ,
76+ $ usableWidth , self ::FIELD_SIZE , true , 0 , 0.01
77+ );
78+ $ currentY += self ::FIELD_SIZE + self ::FIELD_MARGIN ;
79+ }
80+
81+ }
82+ }
83+
84+
85+ ?>
0 commit comments