Beispiel #1
0
        public void CreatePdf <T>(IList <T> listItems, HttpResponseBase Response)
        {
            if (listItems == null)
            {
                throw new ArgumentNullException("Excel list is Required.");
            }

            if (Response == null)
            {
                throw new ArgumentNullException("Response is Required.");
            }

            var properties = ReportService.GetObjectPropertyInfo <T>();

            TableFactory table = new TableFactory();

            table.InitTable();

            AddPdfTitle <T>(properties.Count(), table);

            ReportService.AddColumnGroup(properties, table);

            ReportService.AddTableColumnHeader(properties, table);

            ReportService.AddTableColumnCell(properties, table, listItems);

            table.EndTable();

            AddResponseHeader(Response);

            DownloadPdf(Response, new MemoryStream(GeneratePdfBiteArray(table.ToHtml())));
        }