I know this is old but here's what I had done to achieve the OP was after. (Forgive me as this is C# but it shouldn't be too hard to convert it)
This is the original code that I had used that displayed the same behavior that you have described!
Response.ClearContent();
Response.ContentType = "application/pdf";
Response.AddHeader("Content-Disposition", "inline; filename=" + docName);
Response.AddHeader("Content-Length", byteArray.Length.ToString());
Response.BinaryWrite(byteArray);
Response.End();
There are two key changes that I had to make to get this to work the way I wanted (Download the file as PDF, then open in a new tab when the user had clicked on that attachment.) and they are both on line 3 of the code above.
Change this
Response.AddHeader("Content-Disposition", "inline; filename=" + docName);
To this
Response.AddHeader("Content-Disposition", "attachment; filename=" + docName + ".pdf");
If you specify the Content-Disposition as "Inline" it will output the file content in your current window.
You need to change that disposition to "attachment" AND make sure your extension suffix is explicitly set to .pdf.