@@ -42,7 +42,7 @@ You can of course also manually edit your composer.json file
42
42
43
43
> Some TSPL2-like printers, such as Atol BP41/Rongta RP410, do not support all TSPL2 features.
44
44
45
- ##### Read data from printer
45
+ #### Read data from printer
46
46
47
47
``` php
48
48
use PhpAidc\LabelPrinter\Printer;
@@ -51,17 +51,19 @@ use PhpAidc\LabelPrinter\Connector\NetworkConnector;
51
51
$printer = new Printer(new NetworkConnector('192.168.x.x'));
52
52
53
53
\var_dump($printer->ask('? VERSION$(0)'));
54
+
54
55
// "Direct Protocol 10.15.017559 \r\n"
55
56
```
56
57
57
- ##### Create and print label
58
+ #### Create and print label
58
59
``` php
59
60
use PhpAidc\LabelPrinter\Enum\Unit;
60
61
use PhpAidc\LabelPrinter\Enum\Anchor;
61
62
use PhpAidc\LabelPrinter\Enum\Charset;
62
63
use PhpAidc\LabelPrinter\Printer;
63
64
use PhpAidc\LabelPrinter\Label\Label;
64
65
use PhpAidc\LabelPrinter\Label\Element;
66
+ use PhpAidc\LabelPrinter\CompilerFactory;
65
67
use PhpAidc\LabelPrinter\Connector\NetworkConnector;
66
68
67
69
$label = Label::create(Unit::MM(), 43, 25)
@@ -70,10 +72,10 @@ $label = Label::create(Unit::MM(), 43, 25)
70
72
->add(Element::barcode(10, 10, '123456', 'CODE93')->height(60))
71
73
;
72
74
73
- (new Printer(new NetworkConnector('192.168.x.x')))->print($label);
75
+ (new Printer(new NetworkConnector('192.168.x.x'), CompilerFactory::tspl() ))->print($label);
74
76
```
75
77
76
- ##### Add elements only for a specific language
78
+ #### Add elements only for a specific language
77
79
``` php
78
80
use PhpAidc\LabelPrinter\Label\Label;
79
81
use PhpAidc\LabelPrinter\Label\Element;
@@ -90,7 +92,7 @@ $label = Label::create()
90
92
;
91
93
```
92
94
93
- ##### Add elements if some value is truthy
95
+ #### Add elements if some value is truthy
94
96
``` php
95
97
use PhpAidc\LabelPrinter\Label\Label;
96
98
use PhpAidc\LabelPrinter\Label\Element;
@@ -105,7 +107,7 @@ $label = Label::create()
105
107
;
106
108
```
107
109
108
- ##### Print images
110
+ #### Print images
109
111
``` php
110
112
use PhpAidc\LabelPrinter\Label\Label;
111
113
use PhpAidc\LabelPrinter\Label\Element;
@@ -130,7 +132,7 @@ $label = Label::create()
130
132
;
131
133
```
132
134
133
- ##### Print text with emulation
135
+ #### Print text with emulation
134
136
``` php
135
137
use PhpAidc\LabelPrinter\Label\Label;
136
138
use PhpAidc\LabelPrinter\Label\Element;
@@ -142,7 +144,7 @@ $label = Label::create()
142
144
```
143
145
Text will be drawn with Imagick and printed as bitmap.
144
146
145
- ##### Specify the number of copies
147
+ #### Specify the number of copies
146
148
``` php
147
149
use PhpAidc\LabelPrinter\Label\Label;
148
150
use PhpAidc\LabelPrinter\Label\Element;
@@ -153,20 +155,21 @@ $label = Label::create()
153
155
;
154
156
```
155
157
156
- ##### Batch printing
158
+ #### Batch printing
157
159
``` php
158
160
use PhpAidc\LabelPrinter\Printer;
159
161
use PhpAidc\LabelPrinter\Label\Batch;
160
162
use PhpAidc\LabelPrinter\Label\Label;
161
163
use PhpAidc\LabelPrinter\Label\Element;
164
+ use PhpAidc\LabelPrinter\CompilerFactory;
162
165
use PhpAidc\LabelPrinter\Connector\NetworkConnector;
163
166
164
167
$batch = (new Batch())
165
168
->add(Label::create()->add(Element::textLine(168, 95, 'Hello!', 'Univers', 8)))
166
169
->add(Label::create()->add(Element::textLine(168, 95, 'Bye!', 'Univers', 8)))
167
170
;
168
171
169
- (new Printer(new NetworkConnector('192.168.x.x')))->print($label);
172
+ (new Printer(new NetworkConnector('192.168.x.x'), CompilerFactory::fingerprint() ))->print($label);
170
173
```
171
174
172
175
## License
0 commit comments