I am trying to show a pdf on the screen from a controller. I’ve tried everything I can think of, even using fpdf but I get a blank pdf. I have no problem downloading the pdf like this
$response = $response->withHeader('Content- Description', File_Transfer')
->withHeader('Content-Type', 'application/octet-stream')
->withHeader('ContentDisposition','attachment;filename="'.basename($file).'"')
->withHeader('Expires','0')
->withHeader('Cache-Control','must-revalidate')
->withHeader('Pragma','public')
->withHeader('Content-Length',filesize($file));
readfile($file);
Is there a way to use with header to display a pdf?