Barryvdh\DomPDF\PDF::download PHP Method

download() public method

Make the PDF downloadable by the user
public download ( string $filename = 'document.pdf' ) : Illuminate\Http\Response
$filename string
return Illuminate\Http\Response
    public function download($filename = 'document.pdf')
    {
        $output = $this->output();
        return new Response($output, 200, array('Content-Type' => 'application/pdf', 'Content-Disposition' => 'attachment; filename="' . $filename . '"'));
    }

Usage Example

 /**
  * Make the PDF downloadable by the user
  *
  * @param string $filename
  * @return \Illuminate\Http\Response 
  * @static 
  */
 public static function download($filename = 'document.pdf')
 {
     return \Barryvdh\DomPDF\PDF::download($filename);
 }