Opening a PDF in browser instead of downloading it

前端 未结 3 742
慢半拍i
慢半拍i 2020-12-09 17:19

I\'m using iTextSharp to print a panel into PDF on button click. After clicking on the button, the PDF is downloading to the client\'s computer. Instead of this I need the P

3条回答
  •  温柔的废话
    2020-12-09 17:44

    Change the content-disposition to inline instead of attachment.

    The second line of your snippet would then be

    Response.AddHeader("content-disposition", "inline;filename=" + filename + ".pdf");
    

    See Content-Disposition:What are the differences between "inline" and "attachment"? for further details.

提交回复
热议问题