Skip to content

Commit

Permalink
Handle landscape templates
Browse files Browse the repository at this point in the history
  • Loading branch information
rpungello committed Jan 16, 2024
1 parent db28fa2 commit a92ba16
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/PdfDocument.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,11 @@ class PdfDocument extends TCPDF

public function __construct(protected Label $template, protected bool $forceDebug = false)
{
parent::__construct('P', 'mm', [$template->page_width, $template->page_height]);
if ($this->template->page_width > $this->template->page_height) {
parent::__construct('L', 'mm', [$template->page_width, $template->page_height]);
} else {
parent::__construct('P', 'mm', [$template->page_width, $template->page_height]);
}

$this->numberOfColumns = $this->template->getNumberOfColumns();
$this->numberOfRows = $this->template->getNumberOfRows();
Expand Down

0 comments on commit a92ba16

Please sign in to comment.