public ActionResult PdfTake3(string id) { var person = new Person() { UserName = id, LuckyNumber = 17 }; // return new PdfResult(person, "PdfModel"); return new PdfActionResult("HtmlToPdf", person); }
public ActionResult PdfModel(string id) { // Since type is an ActionResult, we can still return an html view if something isn't right if (id != "yoda") return View("NotFound"); // get Person var person = new Person {UserName = id, LuckyNumber = 7}; // pass in Model, then View name var pdf = new PdfActionResult("HtmlToPdf", person); // Add to the view bag // pdf.ViewBag.Title = "Title from ViewBag"; return pdf; }