Beispiel #1
0
        private void button_Click(object sender, RoutedEventArgs e)
        {
            var context = new WayneCarCorpsContext();

            var pdfExporter = new PdfExporter(new EfRepository <Sale>(context));

            pdfExporter.CreatePdfTable();
        }
        public IActionResult StandingsToPdf()
        {
            PdfExporter pdfExporter = new PdfExporter();
            PdfDocument doc         = new PdfDocument();

            pdfExporter.CreatePdfTable(ref doc, "Locuri buget", mapper.Map <IEnumerable <AdmissionEntryViewModel> >(bugetEntries));
            pdfExporter.CreatePdfTable(ref doc, "Locuri taxa", mapper.Map <IEnumerable <AdmissionEntryViewModel> >(taxaEntries));
            pdfExporter.CreatePdfTable(ref doc, "Locuri rrom", mapper.Map <IEnumerable <AdmissionEntryViewModel> >(rromEntries));
            pdfExporter.CreatePdfTable(ref doc, "Locuri romani de pretutindeni", mapper.Map <IEnumerable <AdmissionEntryViewModel> >(rdpEntries));

            MemoryStream stream = new MemoryStream();

            doc.Save(stream);
            stream.Position = 0;
            doc.Close(true);
            string contentType = "application/pdf";
            string fileName    = "Output.pdf";

            return(File(stream, contentType, fileName));
        }