PDF在浏览器新标签页中打开 [英] PDF to open in browser new tab
本文介绍了PDF在浏览器新标签页中打开的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我希望有人可以帮助我。我正在尝试使用c#在我的asp.net应用程序中打开一个pdf文件。当我使用Visual Studio在我的PC上运行它时,它工作正常。当我尝试在服务器上运行它时,pdf文件没有打开。
这里的代码如下:
此代码是按下按钮编写的。
Response.Write(< script> window.open(''Pdfgenerator.aspx?id =+ txtPatientid.Text +& fi =+ caseid +_ BillReport+ .pdf'',''_ blank'')< / script>);
此代码用
Pdfgenerator.aspx
pdf应该打开。
string id = Request.QueryString [ id]。ToString();
string cs = Request.QueryString [ 科幻跨度>]的ToString();
Response.Clear();
Response.ContentType = Application / PDF;
Response.WriteFile( pdfs / + id + / + id + _跨度> + CS);
Response.Flush();
Response.Close();
谢谢
parithi
解决方案
< blockquote>尝试以下链接
希望这会帮助你..
链接1 [ ^ ]
Link 2 [ ^ ]
Link 3 [ ^ ]
I hope someone can help me with this. I am trying to open a pdf file in my asp.net application using c#. When I run it on my PC with Visual Studio, it works fine. When I try to run it on the server the pdf file is not opening.
here is the code below:
this code is written in button click.
Response.Write("<script>window.open(''Pdfgenerator.aspx?id=" + txtPatientid.Text + "&fi=" + caseid + "_BillReport" + ".pdf '',''_blank'')</script>");
This code is written in
Pdfgenerator.aspx
where the pdf should be open.
string id = Request.QueryString["id"].ToString();
string cs = Request.QueryString["fi"].ToString();
Response.Clear();
Response.ContentType = "Application/PDF";
Response.WriteFile("pdfs/" + id + "/"+id+"_"+cs);
Response.Flush();
Response.Close();
thanks
parithi
解决方案
try below Links
Hope This will Help you..
Link 1[^]
Link 2[^]
Link 3[^]
这篇关于PDF在浏览器新标签页中打开的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文