Closed amitkhese-zz closed 10 years ago
I have a need for this same feature.
II'll implement it.
Your post means two different things:
1) Don't display PDF in browser, but instead download file and specify file name. OR 2) Generate PDF and save it somewhere on server side.
You're in luck today. I happen to need both sets of functionality.
This is done.
First of all..thanks for the great PDF toolkit.its help me a lot and client happy with the functionality.
This below code gives the PDF file for download to direct user.But I want to Save it(Automatically) to specific server path or Blob.Can you please help me in the same.
[ActionDownload] public ActionResult GeneratePdf() { List comments = null;
using (var db = new CandidateEntities())
{
comments = db.Comments.ToList();
}
return new PdfActionResult("GeneratePdf", comments);
}
public class ActionDownloadAttribute : ActionFilterAttribute { public override void OnResultExecuted(ResultExecutedContext filterContext) { filterContext.HttpContext.Response.AddHeader("content-disposition", "attachment; filename=" + "Report.pdf"); base.OnResultExecuted(filterContext); } }
Please let me know if you required more information.
Thanks, Amit.