@dimassony maybe show the full code
Also remember that this will also be affected by browser settings - some browsers may be configured to always download PDF files or open them in a different application (e.g. Adobe Reader)
I assume you want the PDF to display in the browser, rather than forcing a download. If that is the case, try setting the Content-Disposition header with a value of inline.
Yes. But when I'm trying your suggestion, I get an error says "File does not begin with '%PDF-'". I use 'Content-Disposition: inline; filename="the.pdf"'. Do I made a mistake?
good to hear, and great to know the solution! It'd be good if you could post the final code showing which headers you're sending, for anyone else who comes across this question.
sounds like it's not a valid PDF file?