render html and then redirect to action (.net core)
i start learning jsreport recently and i have used the example where it renders the html to pdf and then it downloads.
and to be more specific is the method from github example InvoiceDownload.
Take a look
there is any possibility like render and download and then redirect to action. I am really in need of this example.
HttpContext.JsReportFeature().Recipe(Recipe.PhantomPdf).OnAfterRender(r => HttpContext.Response.Headers["Refresh"] = "15;URL=Redirect Here");
This is what i come up with, based on. It will open in a new tab, and then set some seconds and will redirect to another page
There is nobody here that can help me with this?
I really need some help.
I suggest to take a look at the source code.
Try to inject
IJsReportMVCServiceinto your controller and use its
RenderViewAsyncto invoke particular view rendering at any place in your action and perform the rest of your code including redirect afterwards.
Can you make an example if you are kind, based on your InvoiceDownload code?
I didn't succeed. It keeps giving me 502.3 http error.
This is what i come up with
var renderRequest = new RenderRequest
Engine = Engine.Handlebars,
Recipe = Recipe.PhantomPdf
var report = await JsReportMvcService.RenderViewAsync(HttpContext, renderRequest, RouteData, "CreatePdf", model);
report.Meta.ContentDisposition = "attachment; filename=" + model.Name + ".pdf";
return RedirectToAction("Done", "RegistrationForms");
I really would like someone to help me with this.
There is nobody that can help?