private static void HandleSection(Queue <CallAction> actions, XmlPdfSection section) { actions.Let <SectionBuilder>(SECTIONBUILDER, null, _ => SectionBuilder.New((new Variable <DocumentBuilder>("documentBuilder")).Value)); if (section.applystyle?.Length > 0) { foreach (var style in section.applystyle) { HandleSectionStyle(actions, style); } } if (section.layout != null) { HandleSectionLayout(actions, section.layout); } }
private IEnumerable <SectionBuilder> CreateSections() { // Section 1 var s1 = SectionBuilder.New() .SetStyleFont(exoRegular) .SetMargins(50) .SetSize(_options.PaperSize) .SetOrientation(_options.Orientation) .AddParagraph("Operations Log") .SetAlignment(HorizontalAlignment.Center) .SetFontSize(46) .SetMarginTop(50) .ToSection() .AddParagraph("Book") .SetAlignment(HorizontalAlignment.Center) .SetFontSize(56) .SetMarginTop(10) .ToSection() .AddParagraph("Powered by PDFFlow") .SetFont(exoBold) .SetAlignment(HorizontalAlignment.Right) .SetMarginTop(100) .ToSection(); // Section 2 var s2 = SectionBuilder.New() .SetStyleFont(exoRegular) .SetMargins(_options.SectionMargins) .SetSize(_options.PaperSize) .SetOrientation(_options.Orientation) .SetPageNumberStart(_options.StartingPage - 1); AddRepeatingAreas(s2); StyleBuilder style = StyleBuilder.New() .SetHorizontalAlignment(HorizontalAlignment.Left) .SetVerticalAlignment(VerticalAlignment.Bottom) .SetBackColor(Color.White) .SetFont(exoRegular) .SetFontSize(13); _table = s2.AddTable(); _table.SetMultipageSpread(6, 4); _table .SetRepeatHeaders(true) .SetBorderStroke(Stroke.None, Stroke.Solid, Stroke.None, Stroke.Solid) .SetContentRowStyleTextOverflowAction(_options.TextOverflowAction); _table .AddColumnPercentToTable("#", 5) .AddColumnPercentToTable("Manufacturer", 24) .AddColumnPercentToTable("Model", 16) .AddColumnPercentToTable("VIN", 24) .AddColumnPercentToTable("Date Received", 16) .AddColumnPercentToTable("Source", 15) .AddColumnPercentToTable("#", 5) .AddColumnPercentToTable("Date Sent", 16) .AddColumnPercentToTable("Buyer Name", 30) .AddColumnPercentToTable("Buyer Address", 49); _table .SetHeaderRowStyleFont(exoBold) .SetHeaderRowStyleBackColor(Color.FromRgba(.8f, .8f, .8f)) .SetHeaderRowStyleHorizontalAlignment(HorizontalAlignment.Left) .AddHeaderRow() .ApplyStyle(style) .SetMinHeight(25) .AddCellToRow("") .AddCellToRow("Description of model", 5) .AddCellToRow("") .AddCellToRow("Reciept", 3); // Section 3 var s3 = SectionBuilder.New().SetStyleFont(exoRegular.SetSize(11)); string dateFormat = DateFormat; s3 .SetMargins(_options.SectionMargins) .SetSize(_options.PaperSize) .SetOrientation(_options.Orientation) .AddParagraph("Book Name") .SetAlignment(HorizontalAlignment.Center) .SetMargins(0, 200, 0, 0) .ToSection() .AddParagraph(_options.BookName) .SetAlignment(HorizontalAlignment.Center) .SetFont(exoBold) .ToSection() .AddParagraph("Date of Print") .SetAlignment(HorizontalAlignment.Center) .SetMargins(0, 10, 0, 0) .ToSection() .AddParagraph(_options.DateOfPrint.Value.ToString(dateFormat)) .SetAlignment(HorizontalAlignment.Center) .SetFont(exoBold) .ToSection() .AddParagraph("Date range") .SetAlignment(HorizontalAlignment.Center) .SetMargins(0, 10, 0, 0) .ToSection() .AddParagraph(string.Concat(_options.DateRangeStart.Value.ToString(dateFormat), " - ", _options.DateRangeEnd.Value.ToString(dateFormat))) .SetAlignment(HorizontalAlignment.Center) .SetFont(exoBold) .ToSection() .AddParagraph("Number of Records") .SetAlignment(HorizontalAlignment.Center) .SetMargins(0, 10, 0, 0) .ToSection() .AddParagraph(_options.NumberOfRecords.ToString()) .SetAlignment(HorizontalAlignment.Center) .SetFont(exoBold); return(new List <SectionBuilder> { s1, s2, s3 }); }