Skip to content

Commit 71234a7

Browse files
committed
Extract methods from Label, docs
1 parent 34e8700 commit 71234a7

File tree

2 files changed

+31
-0
lines changed

2 files changed

+31
-0
lines changed

README.md

+27
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,33 @@ $label = Label::create()
126126
```
127127
Text will be drawn with Imagick and printed as bitmap.
128128

129+
##### Specify the number of copies
130+
```php
131+
use PhpAidc\LabelPrinter\Label\Label;
132+
use PhpAidc\LabelPrinter\Label\Element;
133+
134+
$label = Label::create()
135+
->add(Element::textLine(168, 95, 'Hello!', 'Univers', 8))
136+
->copies(3)
137+
;
138+
```
139+
140+
##### Batch printing
141+
```php
142+
use PhpAidc\LabelPrinter\Printer;
143+
use PhpAidc\LabelPrinter\Label\Batch;
144+
use PhpAidc\LabelPrinter\Label\Label;
145+
use PhpAidc\LabelPrinter\Label\Element;
146+
use PhpAidc\LabelPrinter\Connector\NetworkConnector;
147+
148+
$batch = (new Batch())
149+
->add(Label::create()->add(Element::textLine(168, 95, 'Hello!', 'Univers', 8)))
150+
->add(Label::create()->add(Element::textLine(168, 95, 'Bye!', 'Univers', 8)))
151+
;
152+
153+
(new Printer(new NetworkConnector('192.168.x.x')))->print($label);
154+
```
155+
129156
## License
130157

131158
The PhpAidc LabelPrinter is open-sourced software licensed under the [MIT license](http://opensource.org/licenses/MIT).

src/Contract/Label.php

+4
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ interface Label extends Job
2121
{
2222
public function charset(Charset $value);
2323

24+
public function copies(int $copies);
25+
2426
public function direction(Direction $value);
2527

2628
public function add(Command $command);
@@ -29,5 +31,7 @@ public function getMedia(): array;
2931

3032
public function getCharset(): ?Charset;
3133

34+
public function getCopies(): int;
35+
3236
public function getCommands(string $language): iterable;
3337
}

0 commit comments

Comments
 (0)