我使用的對象標籤來顯示PDF的HTML,但我做的MVC是這樣的:顯示PDF在網絡
<object data="/JDLCustomer/GetPDFData?projID=<%=ViewData["ProjectID"]%>&folder=<%=ViewData["Folder"] %>"
type="application/pdf" width="960" height="900">
</object>
和控制器/動作是
public void GetPDFData(string projID, Project_Thin.Folders folder)
{
Highmark.BLL.Models.Project proj = GetProject(projID);
List<File> ff = proj.GetFiles(folder, false);
if (ff != null && ff.Count > 0 && ff.Where(p => p.FileExtension == "pdf").Count() > 0)
{
ff = ff.Where(p => p.FileExtension == "pdf").ToList();
Response.ClearHeaders();
Highmark.BLL.PDF.JDLCustomerPDF pdfObj = new JDLCustomerPDF(ff, proj.SimpleDbID);
byte[] bArr = pdfObj.GetPDF(Response.OutputStream);
pdfObj = null;
Response.ContentType = "application/" + System.IO.Path.GetExtension("TakeOffPlans").Replace(".", "");
Response.AddHeader("Content-disposition", "attachment; filename=\"TakeOffPlans\"");
Response.BinaryWrite(bArr);
Response.Flush();
}
}
問題是,因爲我先從服務器下載數據,然後返回字節數據,下載需要一些時間,所以我想展示某種進度來顯示處理。
請幫我解決這個問題。
AFAIK我們不應該使用此論壇來插入我們自己的產品。 – azarc3 2013-10-30 18:37:12
我認爲我在寫作時(3年前!)讓我的產品晶瑩剔透,這與產品常見問題解答(FAQ)一致。更多關於meta [這裏]的主題(http://meta.stackexchange.com/questions/15787/how-do-i-mention-my-own-products-in-answers)。除此之外,我認爲我在答案中提供了足夠多的相關信息,這不是一個促銷活動。另請注意,該產品一年前已開源。所有的代碼都可以在codeplex [here](https://pdfwebviewer1.codeplex.com/)和[here](http://webviewer2.codeplex.com/)上找到。 – 2013-10-30 19:09:57