Skip to content

A free open source IT asset/license management system

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

Konstantin Köhring2fd357c34661
diff --git a/app/Models/Labels/Label.php b/app/Models/Labels/Label.php
index 8ea92d2e42..bf03236d00 100644
--- a/app/Models/Labels/Label.php
+++ b/app/Models/Labels/Label.php
@@ -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
*
diff --git a/app/View/Label.php b/app/View/Label.php
index 3ec3a4099c..ee734fd98f 100644
--- a/app/View/Label.php
+++ b/app/View/Label.php
@@ -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