Opening a PDF in browser instead of downloading it

前端 未结 3 751
慢半拍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:51

    Try This Code :

    Action:

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

    To open in new Tab/Window:

    @Html.ActionLink("view pdf", "getpdf", "somecontroller", null, 
                      new { target = "_blank" })
    

    OR

    
    

提交回复
热议问题