Welcome Guest Search | Active Topics | Sign In | Register

Returning to MVC View After RenderAsPDF Options
EssKay
Posted: Tuesday, June 18, 2019 4:54:25 PM
Rank: Newbie
Groups: Member

Joined: 6/18/2019
Posts: 4
Hi,
I'm using trial version 2019 . Thank you so much for your great support.

I'm facing one issue , after MVC view is rendered successfully, I have to return to different view , I tried with several approaches such as RedirectToAction , return View("Index") , etc...but its not redirecting. I'm clueless how to resolve it.

Could you please kindly help to resolve it.

This is the only issue I'm having , otherwise, I'm perfectly fine with EO libraries.

The code is like this,

[EO.Pdf.Mvc.RenderAsPDF(AutoConvert = false)]
public ActionResult CreatePDF()
{
HtmlToPdf.Options.BeforeRenderPage += this.On_BeforeRenderPage;

MVCToPDF.SendToClient = true;
MVCToPDF.ResultAsDownload = false;
MVCToPDF.ResultFileName = "TestFile.PDF";
MVCToPDF.RenderAsPDF(AfterRender);

return View("Index");
//ReDirectToAction("Index","Home");
//Index();
}
eo_support
Posted: Wednesday, June 19, 2019 4:52:32 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,258
Hi,

You will need to apply the RenderAsPDF attribute on the last action in this case. In your case, you should apply the attribute and call RenderAsPDF inside your Index action. You may want to set/pass some flag to the Index action from your CreatePDF action and then check for this flag in your Index action. The rule is it applies to the last leg since the HTML to PDF converter needs to intercept the final output.

Thanks!
EssKay
Posted: Wednesday, June 19, 2019 10:47:18 PM
Rank: Newbie
Groups: Member

Joined: 6/18/2019
Posts: 4
Thanks for the reply , I try with your approach.


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.