我的应用程序是 MVC3(ASPX 视图)。我有一个表单,在编辑视图中我有保存按钮,用于保存表单并返回到索引页面,以及另一个按钮,用于从与编辑相同的控制器中的另一个 ActionResult 打印 PDF;有没有一种方法可以通过一个按钮保存和打印 PDF?这是我的编辑视图脚本:
public ActionResult EditCTAH(long learnerID = 0, long caseListID = 0)
{
ViewBag.caseListID = (long)Session["_CTA_CaseListId"];
try
{
CTAHFormEdit ctform = _learnerscaseListsSvc.GetCTAHForm(learnerID, caseListID);
return View(ctform);
}
catch
{
return null;
}
}
[HttpPost]
public ActionResult EditCATH(CTAHFormEdit ctform)
{
if (ModelState.IsValid)
{
_learnerscaseListsSvc.EditCTAHForm(ctform);
long courseId = (long)Session["_CTA_CourseId"];
long caseId = (long)Session["_CTA_CaseId"];
long caselistId = (long)Session["_CTA_CaseListId"];
return RedirectToAction("Index", new { courseId = courseId, caseId = caseId, caselistId = caselistId });
}
return View(ctform);
}
这是打印 PDF 的脚本:
public ActionResult EvaluationCATH_PDF(long learnerID = 0, long caseListID = 0)
{
try
{
.....
pdfStamper.Close();
byte[] byteInfo = workStream.ToArray();
SendPdfToBrowser(byteInfo, cth.Learner_ID, cth.StudyCase_ID);
return null;
}
catch
{
return null;
}
}
提前致谢。