Add rotation attribute to Label class to allow rotation of the generated label PDF.

This is necessary when printing labels with width = label width.
This commit is contained in:
Konstantin Köhring 2024-06-13 17:14:17 +02:00 committed by Gitlab CI
parent 7dbcedad40
commit 2fd357c346
2 changed files with 12 additions and 1 deletions

View file

@ -25,6 +25,17 @@ abstract class Label
*/
public abstract function getUnit();
/**
* Returns the PDF rotation.
* 0, 90, 180, 270
* 0 is a sane default. Override when necessary.
*
* @return int
*/
public function getRotation() {
return 0;
}
/**
* Returns the label's width in getUnit() units
*

View file

@ -54,7 +54,7 @@ class Label implements View
$pdf = new TCPDF(
$template->getOrientation(),
$template->getUnit(),
[ $template->getWidth(), $template->getHeight() ]
[0 => $template->getWidth(), 1 => $template->getHeight(), 'Rotate' => $template->getRotation()]
);
// Reset parameters