0
A
回答
0
俄德給你最佳的解決方案,但是,如果你仍然想這樣做的,這裏有雲:
你可以使用這個jQuery plugin。
你的網頁將有一個超鏈接:
<a id="PrintAjaxReport" href="javascript:{}">Print report Ajax</a>
的jQuery:
$(document).ready(function() {
$("#PrintAjaxRepor").click(function() {
$.download('PdfReport.aspx', "filename=mySpreadsheet", "POST");
});
});
PdfReport.aspx
public partial class PdfReport : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
var pdfDocumentName = Request.Params["filename"].ToString() + ".pdf";
var myReport = "Razor Syntax Quick Reference.pdf";
var FileName = Path.Combine(Path.Combine(Server.MapPath("~"), "Temp"), myReport);
Response.Clear();
Response.ClearHeaders();
Response.ClearContent();
Response.ContentType = "application/pdf";
Response.AddHeader("Content-Type", "application/pdf");
Response.AddHeader("content-disposition", "attachment; filename=" + pdfDocumentName);
Response.TransmitFile(FileName);
Response.End();
}
}
你可以找到一個樣本(OpenPDFjQuery)here。
相關問題
- 1. Asp.net mvc ajax用參數打開pdf
- 2. 使用Putty ssh打開.pdf?
- 3. 使用node-webkit打開.pdf
- 4. Ajax調用Asp.net Web方法使用jQuery
- 5. 使用Angular 2調用ASP.Net Web方法
- 6. 無法打開pdf文件
- 7. 無法打開pdf圖r
- 8. 使用web應用程序打印pdf
- 9. 用javascript打開PDF
- 10. 使用Web方法獲取HttpRequest ASP.NET
- 11. 不推薦使用ASP.NET Web方法
- 12. 使用Python使用Photoshop打開PDF
- 13. 在asp.net中打開pdf文件c#
- 14. 從asp.net打開PDF文件mvc /腳本
- 15. 在ASP.NET的網頁中打開PDF
- 16. 在asp.net中打開pdf文檔
- 17. ASP.Net Web方法405
- 18. 使用PDFCreator打印GMF圖表無法打開生成的pdf
- 19. 使用ASP.NET MVC上的表單文本框打開PDF文件
- 20. 如何使用iframe在ASP.Net MVC的特定頁面打開pdf
- 21. 用office365打開文檔使用ASP.NET C#web應用程序
- 22. 使用iText打開PDF時自動打開打印對話框
- 23. 使用「運行方式」運行Internet Explorer無法打開新的PDF窗口
- 24. AWS - 無法打開asp.net web應用程序後成功發佈
- 25. 如何在打印PDF時不使用Bluebeam打開revu PDF的
- 26. 如何使用ajax調用打開PDF
- 27. 使用ASP.NET生成打印質量PDF
- 28. 使用Acrobat Reader從ASP.Net(c#)打印PDF
- 29. 以編程方式打開PDF並以PDF格式打印C#
- 30. 無法在IE8中打開.pdf文件
如果文件很大,你需要以某種方式顯示_download_的進度,那麼你應該參考這裏:http://stackoverflow.com/questions/676348/allow-user-to-download-file-using- ajax –
任何原因爲什麼一個簡單的鏈接不會做? – Oded
你想讀取服務器端的pdf嗎? –