You are here

public function MpdfGenerator::setPageOrientation in PDF generator API 8

Same name and namespace in other branches
  1. 2.x src/Plugin/PdfGenerator/MpdfGenerator.php \Drupal\pdf_api\Plugin\PdfGenerator\MpdfGenerator::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 MpdfGenerator::setPageOrientation()
MpdfGenerator::setter in src/Plugin/PdfGenerator/MpdfGenerator.php
Set the various options for PDF.

File

src/Plugin/PdfGenerator/MpdfGenerator.php, line 113
Contains \Drupal\pdf_api\Plugin\MpdfGenerator.

Class

MpdfGenerator
A PDF generator plugin for the mPDF library.

Namespace

Drupal\pdf_api\Plugin\PdfGenerator

Code

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