Open stream as pdf

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi, I'm using this code to open a pdf BinaryStream from database as pdf
Document and it's working :
Response.AddHeader("Content-Disposition", "attachment;filename=File.pdf");
Response.ContentType = "application/pdf";
Response.BinaryWrite(myfile);
Response.Flush();
Response.Close();

The only thing that the browser is poping up a message to "Open", "Save" or
"Cancel" document before openning it.
So, I change the top linr of code with:
Response.AddHeader("Content-Disposition", "inline;filename=File.pdf");
and the problem is that the document is opened in the same main page.

So, how can I force the generated PDF Document to Just open up directly in a
new page, when running the code!!?


Thanks
 
You need to change the link to your page from

<a href="PDFWriter.aspx">

to

<a href="PDFWriter.aspx" target="_blank">
 
Back
Top