You are here

public function WkhtmltopdfController::download in wkhtmltopdf 8

Force download and now redirect.

Parameters

string $file_path_physical: File path.

string $filename: File name.

1 call to WkhtmltopdfController::download()
WkhtmltopdfController::generatePdf in src/Controller/WkhtmltopdfController.php
Generate pdf file.

File

src/Controller/WkhtmltopdfController.php, line 100

Class

WkhtmltopdfController
Base for Controller.

Namespace

Drupal\wkhtmltopdf\Controller

Code

public function download($file_path_physical, $filename) {
  header("Content-type: octet/stream");
  header("Content-disposition: attachment; filename=" . $filename . ";");
  header("Content-Length: " . filesize($file_path_physical));
  readfile($file_path_physical);
  exit;
}