want to display pdf in php so i created following code
$file = '../public/'.$ref;
header('Content-Type: application/pdf');
header('Content-Disposition: inline; filename="' . $filename . '"');
header('Content-Transfer-Encoding: binary');
header('Accept-Ranges: bytes');
@readfile($file);
but browser showing weird contents , like below image
i changed Content-Disposition in to attachment, its working fine but no luck in inline what i can do to fix this issue thanks in advance
header('Content-Transfer-Encoding: binary'); header('Accept-Ranges: bytes');
2)Try different browser. Are you sure that your browser can load PDF inline? Does it do for other sites? Ideally,Content-Disposition: attachment;
is more common, unless you have specific requirement. – Kamal Soni