gpt4 book ai didi

c# - 在新标签页中打开 PDF

转载 作者:太空狗 更新时间:2023-10-30 01:09:20 28 4
gpt4 key购买 nike

在按钮上单击我生成一个 PDF 文件,然后在客户端打开它:

Response.ContentType = "application/pdf";
Response.TransmitFile(path);

这将在浏览器中显示 pdf,但在同一个选项卡中。如何在新标签页中打开它?

最佳答案

<%@ Page Language="C#" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script language=vbscript>
sub OpenInNewWindow()
window.open("PDFContainer.aspx")
end sub
</script>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
<title>Way 3</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<input type=button OnClick="OpenInNewWindow()" value="Open in New Window"/>
<br /><br />
This time, we will open a new Internet Explorer Window and Show the PDF File directly in the IE
</div>
</form>
</body>
</html>

关于c# - 在新标签页中打开 PDF,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7089957/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com