2014-09-30 21 views
1

我們有一個「導出到pdf」按鈕,單擊時會生成冗長的報告。該PDF與Rotativa一起生成。我們需要在生成PDF(簡單)時顯示一條消息,並在生成PDF(困難)後將其解除。我沒有在ViewAsPdf()方法中看到任何鉤子,這將使我們能夠在生成PDF之後關閉消息。有沒有人能夠解決這個問題?什麼鉤子,如果有的話?使用C#和Rotativa生成PDF後,移除狀態消息

我試圖隱藏PDF生成後的消息。

感謝與讚賞得多

在查看

<!-- The message we show to the user after they click the export to PDF button --> 
<div id="pdfProcessing" style="display: none; border:1px solid #666666;"> 
       <img src="@Url.Content("~/Content/images/logo.png")" alt="@Index.PdfProcessing ..." /> 
       <h2>@Index.PdfProcessing ...</h2> 
       <div>@Index.PdfProcessingMessage</div> 
</div> 

JavaScript的按鈕單擊處理

//Displays message when the export to PDF button is clicked 
<script type="text/javascript"> 

    $("#export-pdf-btn").click(function() { 

     $('#pdfProcessing').show(); 
    }); 
</script> 

控制器動作

消息
// Export to PDF button action handler 
public ActionResult Pdf(string districtId, int year, int month) 
{ 
    return new ViewAsPdf("Index", EducationReportTasks.BuildViewModel(User, districtId, year, month, true)) 
    { 
     FileName = districtId + "-" + year + "-" + month + "-report.pdf" 
    }; 
} 

回答