简体   繁体   中英

How to itextsharp PDF open in new tab in chrome using asp.net c#

I m using this code but its not working . Pdf File open in same page this is my code

        Response.Clear();
        Response.ClearContent();
        Response.ClearHeaders();
        Response.ContentType = "application/pdf";
        Response.Charset = string.Empty;
        Response.Cache.SetCacheability(System.Web.HttpCacheability.Public);
        Response.AddHeader("Content-Disposition",
            "inline; filename=ChallanReceive.pdf");
        Response.OutputStream.Write(PDFData.GetBuffer(), 0, PDFData.GetBuffer().Length);

        Response.OutputStream.Flush();
        Response.OutputStream.Close();
        Response.End(); 

Just use a hyperlink to the pdf file and set the target to "_blank."

<a href="YourURL" target="_blank">

This will solve you the problem.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM