Skip to content

Commit

Permalink
Extract methods from Label, docs
Browse files Browse the repository at this point in the history
  • Loading branch information
jhaoda committed Jul 2, 2020
1 parent 34e8700 commit 71234a7
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
27 changes: 27 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,33 @@ $label = Label::create()
```
Text will be drawn with Imagick and printed as bitmap.

##### Specify the number of copies
```php
use PhpAidc\LabelPrinter\Label\Label;
use PhpAidc\LabelPrinter\Label\Element;

$label = Label::create()
->add(Element::textLine(168, 95, 'Hello!', 'Univers', 8))
->copies(3)
;
```

##### Batch printing
```php
use PhpAidc\LabelPrinter\Printer;
use PhpAidc\LabelPrinter\Label\Batch;
use PhpAidc\LabelPrinter\Label\Label;
use PhpAidc\LabelPrinter\Label\Element;
use PhpAidc\LabelPrinter\Connector\NetworkConnector;

$batch = (new Batch())
->add(Label::create()->add(Element::textLine(168, 95, 'Hello!', 'Univers', 8)))
->add(Label::create()->add(Element::textLine(168, 95, 'Bye!', 'Univers', 8)))
;

(new Printer(new NetworkConnector('192.168.x.x')))->print($label);
```

## License

The PhpAidc LabelPrinter is open-sourced software licensed under the [MIT license](http://opensource.org/licenses/MIT).
Expand Down
4 changes: 4 additions & 0 deletions src/Contract/Label.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ interface Label extends Job
{
public function charset(Charset $value);

public function copies(int $copies);

public function direction(Direction $value);

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

public function getCharset(): ?Charset;

public function getCopies(): int;

public function getCommands(string $language): iterable;
}

0 comments on commit 71234a7

Please # to comment.