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.

    Thank you



  • 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.
    Thank you



  • I suggest to take a look at the source code.

    Try to inject IJsReportMVCService into your controller and use its RenderViewAsync to 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.

    Thank you



  • This is what i come up with

    var renderRequest = new RenderRequest
    {
    Template =
    {
    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.

    Thank you



  • There is nobody that can help?


Log in to reply
 

Looks like your connection to jsreport forum was lost, please wait while we try to reconnect.