You are here

public function WkhtmltopdfGenerator::setter in PDF generator API 8

Same name and namespace in other branches
  1. 2.x src/Plugin/PdfGenerator/WkhtmltopdfGenerator.php \Drupal\pdf_api\Plugin\PdfGenerator\WkhtmltopdfGenerator::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/WkhtmltopdfGenerator.php, line 82
Contains \Drupal\pdf_api\Plugin\WkhtmltopdfGenerator.

Class

WkhtmltopdfGenerator
A PDF generator plugin for the WKHTMLTOPDF 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
    ->configBinary($path_to_binary);
  $this
    ->addPage($pdf_content);
  $this
    ->setPageSize($paper_size);
  $this
    ->setPageOrientation($paper_orientation);

  // Uncomment below line when need to add header and footer to page,
  // also make changes in the templates too.
  // $this->setHeader($header_content);
  // $this->setFooter($footer_content);
}