-1

Refered from Removing a "Print" button Before Rendering PDF from View - MVC3

enter image description here

Can anyone please provide the controller part of this answer??

Thanks in advance.. Merin

Community
  • 1
  • 1

1 Answers1

0

i dont think anyone can provide the controller but here is something that can help. You can install Rotativa for that purpose then create two actions like

public ActionResult Page(int id)
{

    var data =  //here you will get data from database by id
    return View(data);
}

public ActionResult PrintPage(int Id)
{
  return new ActionAsPdf(
                 "Page", 
                 new { id= Id}) 
                 { FileName = "Page.pdf" };
}

and also there will be view of name Page in which data will be populated when it will return the view of action Page it will be converted to pdf

Usman
  • 4,615
  • 2
  • 17
  • 33