You are here

public function MpdfGenerator::setter 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::setter()

Set the various options for PDF.

Parameters

string $pdf_content: The HTML content of PDF.

string $pdf_location: The location where PDF needs to be saved.

bool $save_pdf: Stores the configuration whether PDF needs to be saved or shown inline.

string $paper_orientation: The orientation of PDF pages (portrait or landscape).

string $paper_size: The size of PDF paper (e.g. A4, B4, Letter).

string $footer_content: The text to be rendered as footer.

string $header_content: The text to be rendered as header.

string $path_to_binary: The path to binary file.

Overrides PdfGeneratorInterface::setter

File

src/Plugin/PdfGenerator/MpdfGenerator.php, line 79
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 setter($pdf_content, $pdf_location, $save_pdf, $paper_orientation, $paper_size, $footer_content, $header_content, $path_to_binary = '') {
  $this
    ->setPageSize($paper_size);
  $this
    ->setPageOrientation($paper_orientation);

  // Save until the generator is constructed in the preGenerate method.
  $this->headerContent = $header_content;
  $this->pdfContent = $pdf_content;
  $this->footerContent = $footer_content;
}