You are here

public function TcpdfGenerator::setPageOrientation in PDF generator API 2.x

Same name and namespace in other branches
  1. 8 src/Plugin/PdfGenerator/TcpdfGenerator.php \Drupal\pdf_api\Plugin\PdfGenerator\TcpdfGenerator::setPageOrientation()

Set the paper orientation of the generated PDF pages.

Parameters

PdfGeneratorInterface::PORTRAIT|PdfGeneratorInterface::LANDSCAPE $orientation: The orientation of the PDF pages.

Overrides PdfGeneratorInterface::setPageOrientation

1 call to TcpdfGenerator::setPageOrientation()
TcpdfGenerator::setter in src/Plugin/PdfGenerator/TcpdfGenerator.php
Set the various options for PDF.

File

src/Plugin/PdfGenerator/TcpdfGenerator.php, line 91
Contains \Drupal\pdf_api\Plugin\TcpdfGenerator.

Class

TcpdfGenerator
A PDF generator plugin for the mPDF library.

Namespace

Drupal\pdf_api\Plugin\PdfGenerator

Code

public function setPageOrientation($orientation = PdfGeneratorInterface::PORTRAIT) {
  if ($orientation == 'portrait') {
    $orientation = 'P';
  }
  else {
    $orientation = 'L';
  }
  $this->generator
    ->setPageOrientation($orientation);
}