Setting the
Content-Disposition
to
attachment
forces the browser to download the file.
Change it to
inline
to let the browser display the file inline:
context.Response.AddHeader("Content-Disposition", "inline; filename=" + filePath);
Content-Disposition - HTTP | MDN[
^]
NB: Some browsers don't support displaying PDFs inline. You'll need to use a library like
PDF.js[
^] if you need to support them.