andyhutch77 / MvcRazorToPdf

Create pdf documents within an asp .net mvc project by generating your views as normal but returning a PdfActionResult. This converts regular produced razor/html to pdf documents in the browser using the iTextXmlWorker.
125 stars 105 forks source link

Download PDF to Specific location #11

Closed amitkhese-zz closed 10 years ago

amitkhese-zz commented 10 years ago

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.

ElanHasson commented 10 years ago

I have a need for this same feature.

II'll implement it.

ElanHasson commented 10 years ago

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.

ElanHasson commented 10 years ago

This is done.