Create PDF from Array (List, DataTable, ...)
using ArrayToPdf;
var items = Enumerable.Range(1, 100).Select(x => new
{
Prop1 = $"Text #{x}",
Prop2 = x * 1000,
Prop3 = DateTime.Now.AddDays(-x),
});
var pdf = items.ToPdf();
Result: example1.pdf
var pdf = items.ToPdf(schema => schema
.Title("Example name")
.ColumnName(m => m.Name.Replace("Prop", "Column #")));
Result: example2.pdf
var pdf = items.ToPdf(schema => schema
.ColumnSort(m => m.Name, desc: true));
Result: example3.pdf
var pdf = items.ToPdf(schema => schema
.PageOrientation(PdfOrientations.Portrait)
.PageMarginLeft(15)
.AddColumn("MyColumnName #1", x => x.Prop1, 30)
.AddColumn("MyColumnName #2", x => $"test:{x.Prop2}")
.AddColumn("MyColumnName #3", x => x.Prop3));
Result: example4.pdf
var pdf = items.ToPdf(schema => schema
.ColumnFilter(m => m.Name != "Prop2"));
Result: example5.pdf
var table = new DataTable("Example Table");
table.Columns.Add("Column #1", typeof(string));
table.Columns.Add("Column #2", typeof(int));
table.Columns.Add("Column #3", typeof(DateTime));
for (var x = 1; x <= 100; x++)
table.Rows.Add($"Text #{x}", x * 1000, DateTime.Now.AddDays(-x));
var pdf = table.ToPdf();
Result: example6.pdf