I am doing:
header('Content-type: application/pdf');
header('Content-Disposition: inline; filename="the.pdf"');
header('Content-Length: ' . filesize($file));
@readfile($file);
and it works fine. The PDF opens in the browser.
Can I do an if-then-else before? I tried and I get raw PDF
%PDF-1.2 9 0 obj << /Type/Font /Subtype/Type1 /Name/F1 /FontDescriptor 8 0
Why is the if-then-else changing the headers?
thanks.
It would be helpful if you posted exactly what is your if-then-else code. My guess is you have some whitespace output before the headers are outputted.