Question : view a pdf file in the browser using the php header function
Answered by : sleepy-scarab-b2t45feyesjo
$file = 'headerPdfFile.pdf';
$filename = 'IamPdfFile.pdf';
// Header content type
header('Content-type: application/pdf');
header('Content-Disposition: inline; filename="' . $filename . '"');
// Read the file
@readfile($file);
Source : https://www.quizcure.com/php/header-pdf-open-in-browser | Last Update : Sun, 10 Oct 21