Open stream as pdf

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
 
A

Aidy

You need to change the link to your page from

<a href="PDFWriter.aspx">

to

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

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,743
Messages
2,569,478
Members
44,898
Latest member
BlairH7607

Latest Threads

Top