如何在浏览器的不同选项卡中打开PDF文档 [英] How to Open a PDF document in Different tab of the browser

查看:102
本文介绍了如何在浏览器的不同选项卡中打开PDF文档的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用以下代码在浏览器中打开pdf文件,但是它在浏览器的同一选项卡中打开.我想在浏览器的其他选项卡中打开它.
可能吗?如果是这样,请帮助我..
-------------------------------------------------- -------------------

I am using the following code to open a pdf file in my browser.But it is opening in the same tab of the browser. I want open it in different tab of the browser.
Is it possible? If so please help me..
---------------------------------------------------------------------

protected void Button1_Click(object sender, EventArgs e)
   {
       string pdfPath = "D:\\Data\\Misc\\Time+registration.pdf";
       WebClient client = new WebClient();
       Byte[] buffer = client.DownloadData(pdfPath);
       Response.ContentType = "application/pdf";
       Response.AddHeader("content-length", buffer.Length.ToString());
       Response.BinaryWrite(buffer);
   }




-------------------------------------------------- ---------------------
预先感谢.




-----------------------------------------------------------------------
Thanks in advance.

推荐答案

hi
尝试检查以下链接:

http://forums.asp.net/t/1416989.aspx/1 [ ^ ]

http://www.vbforums.com/showthread.php?t=640505 [ ^ ]

问候
罗伯特
hi
try to check following links:

http://forums.asp.net/t/1416989.aspx/1[^]
or
http://www.vbforums.com/showthread.php?t=640505[^]

regards
Robert


试试这个
http://stackoverflow.com/questions/7089957/open-pdf-in-new-tab [ ^ ]
try this
http://stackoverflow.com/questions/7089957/open-pdf-in-new-tab[^]


我的解决方法如下
------------------------
My Sulution is as follows
------------------------
//in Caller.aspx
//--------------

<script type="text/javascript">
    function openwindow() {
        window.open("Callee.aspx.aspx", "windowName", "height=500, width=700");
    }

</script>

<asp:Button ID="Button1" runat="server" OnClientClick="openwindow()" Text="Button" />


//In Callee.aspx
//--------------
using System.Net;



 protected void Page_Load(object sender, EventArgs e)
    {
        string pdfPath = "D:\\Data\\Misc\\Time+registration.pdf";
        WebClient client = new WebClient();
        Byte[] buffer = client.DownloadData(pdfPath);
        Response.ContentType = "application/pdf";
        Response.AddHeader("content-length", buffer.Length.ToString());
        Response.BinaryWrite(buffer);
    }


这篇关于如何在浏览器的不同选项卡中打开PDF文档的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆