PDF stream to a new browser instance or tab?

I want to transfer the PDF to a new instance of the browser. I have it now

Response.ContentType = "application/pdf"
Response.AddHeader("Content-Disposition", "inline; filename=""" & Path.GetFileName(pdfFile) & """")
Response.AddHeader("Content-Length", stream.Length)
Response.BinaryWrite(stream.ToArray())
Response.Flush()

But it captures my existing window and pushes me off the page. I want to create a new tab or window and display the PDF there.

Does anyone know how to do this?

+3
source share
2 answers

You might want to consider an attribute <a>. You can use this to open a PDF file in a new window, perhaps using something like:

<a href="GeneratePdf.ashx?somekey=10" target="_blank">

- , , , , MercerTraieste.

ASP.NET, HttpHandler PDF .

+3

, :

Response.AddHeader("Content-Disposition", "attachment;filename""" & Path.GetFileName(pdfFile) & """")
+3

Source: https://habr.com/ru/post/1712339/


All Articles