public ActionResult PersonPdf()
        {
            var person = new Person { Name = "Satoshi", Age = 24, Address = "Gifu" };

            var result = new PdfResult(person, "PersonPdf");
            result.ViewBag.Title = "Today's Member List";

            return result;
        }
        public ActionResult ReportSample()
        {
            var list = new List<Person>();

            for (int i = 1; i < 10; i++)
                list.Add(new Person() { UserName = "******" + i.ToString(), LuckyNumber = i });

            var pdf = new PdfResult(list, "ReportSample");
            pdf.ViewBag.Title = "Report Title";

            return pdf;
        }
        public ActionResult PeoplePdf()
        {
            var people = new List<Person> {
                new Person{Name="Satoshi", Age=24, Address = "Gifu"},
                new Person{Name="Hanako", Age=23, Address = "Nagoya"},
                new Person{Name="Steve", Age=29, Address = "Osaka"},
                new Person{Name="Fu-ta", Age=25, Address = "Ishikawa"}
            };

            var result = new PdfResult(people, "PeoplePdf");
            result.ViewBag.Title = "Today's Member List";

            return result;
        }
Exemple #4
0
 public ActionResult Pdf(string format)
 {
     // get Person
     var persons = new List<Person>() {
         new Person { Name = "Alfred Einstein"  , City = "Berlin"},
         new Person { Name = "Alfred Nobel" , City = "Karlskoga" },
         new Person { Name = "Niels Bohr" , City = "Copenhagen" }
     };
     if (string.IsNullOrEmpty(format))
     {
         // pass in Model, then View name
         var pdf = new PdfResult(persons, "PdfModelHtml");
         // Add to the view bag
         pdf.ViewBag.Title = "Big scientists";
         return pdf;
     }
     ViewBag.Title = "Big scientists";
     return View("PdfModelHtml", persons);
 }
        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();
            person.UserName = id;
            person.LuckyNumber = 7;

            // pass in Model, then View name
            var pdf = new PdfResult(person, "PdfModel");

            // Add to the view bag
            pdf.ViewBag.Title = "Title from ViewBag";

            return pdf;
        }
        public ActionResult Pdf(int id = 0)
        {
            Resume applicant = db.Resumes.FirstOrDefault(r => r.ApplicantID == id);
            if (applicant != null)
            {
                var pdfresult = new PdfResult(applicant, "Pdf");

                pdfresult.ViewBag.Title = "Resume";

                return pdfresult;

            }
            else
            {
                return null;
            }
        }
 public ActionResult ViewResult(int studentId)
 {
     var enrollments = db.Enrollments.Where(e => e.StudentId == studentId);
     var pdf = new PdfResult(enrollments.ToArray(), "ViewPDFResult");
     return pdf;
 }
        public ActionResult download()
        {
            PaymentInvoice tempinvoice = new PaymentInvoice().GetInvoice(Request.QueryString["tid"].ToString(), Session["companyid"].ToString(), Session["userid"].ToString());
            string data = tempinvoice.invoicedata;
            XDocument invoicedoc = new XDocument();
            try
            {
                invoicedoc = XDocument.Parse(data);
            }
            catch
            {

            }

            var pdf = new PdfResult(tempinvoice, "download");

            string filename = "attachment; filename=" + invoicedoc.Descendants("client").First().Descendants("compname").First().Value.ToString() + "-" + invoicedoc.Descendants("metadata").First().Descendants("id").First().Value.ToString() + ".pdf";

            pdf.ViewBag.Title = "Invoice";
            Response.ContentType = "application/pdf";
            Response.AddHeader("Content-Disposition", filename);

            return pdf;

            // return View();
        }
Exemple #9
0
 public ActionResult Receipt()
 {
     var model = new BuyModel();
     if (TempData["Invoice"] != null)
     {
         model = (BuyModel)TempData["Invoice"];
     }
     var pdf = new PdfResult(model, "Receipt");
     return pdf;
 }
 //Action para generar vistas pdf lo mejor es utilizar xml 
 public ActionResult Pdf()
 {
     var pdfResult = new PdfResult(null, "Pdf");
     return pdfResult;
 }
        public ActionResult ViewPdfResult(int? studentId)
        {
            var pdfResult = new PdfResult(
                        db.Enrollments.Include(s => s.Student)
                        .Where(s => s.Student.StudentId == studentId)
                        .Include(s => s.Student.Department)
                        .Include(s => s.Course)
                        .Include(s => s.Grade),
                        "ViewPdfResult"
                        );

            return pdfResult;
        }