I am using Rotativa to generate PDF in my "MVC" application. How can I save Rotativa PDF? I need to save the document on a server after all the process is completed.
Code below:
public ActionResult PRVRequestPdf(string refnum,string emid)
{
var prv = functions.getprvrequest(refnum, emid);
return View(prv);
}
public ActionResult PDFPRVRequest()
{
var prv = Session["PRV"] as PRVRequestModel;
byte[] pdfByteArray = Rotativa.WkhtmltopdfDriver.ConvertHtml("Rotativa", "Approver", "PRVRequestPdf");
return new Rotativa.ViewAsPdf("PRVRequestPdf", new { refnum = prv.rheader.request.Referenceno });
}
Another useful answer:
I found the solution here
This is the original thread
You can give this a try
If that doesn't do the trick then, you can follow the answers here
Just make sure if you do it this way not to have
PRVRequestPdf
return as a PDF View, rather a normal View like you have above (only mention as managed to fall foul of that myself causing lots of fun).