2014-09-30 64 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" 
    }; 
} 

回答