You are here

public function PhpWkhtmlToPdf::send in Entity Print 8.2

Send the Print contents to the browser.

Parameters

string $filename: The filename if we want to force the browser to download.

bool $force_download: TRUE to attempt to force the browser to download the PDF otherwise FALSE.

Throws

\Drupal\entity_print\PrintEngineException Thrown when Print generation fails.

Overrides PrintEngineInterface::send

File

src/Plugin/EntityPrint/PrintEngine/PhpWkhtmlToPdf.php, line 222

Class

PhpWkhtmlToPdf
PHP wkhtmltopdf plugin.

Namespace

Drupal\entity_print\Plugin\EntityPrint\PrintEngine

Code

public function send($filename, $force_download = TRUE) {

  // If the filename received here is NULL, force open in the browser
  // otherwise attempt to have it downloaded.
  if (!$this->pdf
    ->send($filename, !$force_download)) {
    throw new PrintEngineException(sprintf('Failed to generate PDF: %s', $this->pdf
      ->getError()));
  }
}