Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

hasaftab's avatar

i need to export date from data base in form of pdf

public function download()

{ //PDF file is stored under project/public/download/info.pdf $file= public_path(). "/download/hallo.pdf"; //print_r($file); die;

        $headers = array(
                  'Content-Type: application/pdf',
                );

        return Response::download($file, 'filename.pdf', $headers);
    }

my function look like this but its not working its downloading empty file!

my simply route: Route::get('pdf',array('as'=>'pdf','uses'=>'registerController@download'));

0 likes
2 replies

Please or to participate in this conversation.