Skip to content

Commit

Permalink
Added orientation parameter do method drawCode128
Browse files Browse the repository at this point in the history
  • Loading branch information
andersonls committed May 26, 2022
1 parent cdacfea commit 0b951ea
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/ZplBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -204,10 +204,15 @@ public function drawCell(
* {@inheritDoc}
* @see \Zpl\AbstractBuilder::drawCode128()
*/
public function drawCode128(float $x, float $y, float $height, string $data, bool $printData = false) : void
public function drawCode128(float $x, float $y, float $height, string $data, bool $printData = false, $orientation = 'N') : void
{
$validOrientations = ['N', 'R', 'I', 'B'];
if (in_array($orientation, $validOrientations) === false) {
throw new \InvalidArgumentException('Valid values for orientation are: ' . implode(',', $validOrientations));
}

$this->commands[] = '^FO' . $this->toDots($x) . ',' . $this->toDots($y);
$this->commands[] = '^BCN,' . $this->toDots($height) . ',' . ($printData === true ? 'Y' : 'N') . ',N,N,A';
$this->commands[] = '^BC' . $orientation . ',' . $this->toDots($height) . ',' . ($printData === true ? 'Y' : 'N') . ',N,N,A';
$this->commands[] = '^FD' . $data . '^FS';
}

Expand Down

0 comments on commit 0b951ea

Please sign in to comment.