/// <summary> /// Defines custom footer of the each page. /// </summary> /// <param name="pagesFooterBuilder">Pages Footer Builder</param> /// <returns></returns> public PdfReport PagesFooter(Action <PagesFooterBuilder> pagesFooterBuilder) { var builder = new PagesFooterBuilder(this); pagesFooterBuilder(builder); return(this); }
private static PdfGrid createFooter(PagesFooterBuilder footer, string date, FooterData data) { var table = new PdfGrid(numColumns: 4) { WidthPercentage = 100, RunDirection = PdfWriter.RUN_DIRECTION_LTR }; var datePhrase = footer.PdfFont.FontSelector.Process(date); var datePdfCell = new PdfPCell(datePhrase) { RunDirection = PdfWriter.RUN_DIRECTION_LTR, BorderWidthLeft = 0, BorderWidthRight = 0, BorderWidthTop = 1, BorderWidthBottom = 0, Padding = 4, BorderColorTop = new BaseColor(System.Drawing.Color.LightGray), HorizontalAlignment = Element.ALIGN_CENTER }; var nullPdfCell = new PdfPCell { RunDirection = PdfWriter.RUN_DIRECTION_LTR, BorderWidthLeft = 0, BorderWidthRight = 0, BorderWidthTop = 1, BorderWidthBottom = 0, Padding = 4, BorderColorTop = new BaseColor(System.Drawing.Color.LightGray), HorizontalAlignment = Element.ALIGN_RIGHT }; var pageNumberPhrase = footer.PdfFont.FontSelector.Process("Page " + data.CurrentPageNumber + " of "); var pageNumberPdfCell = new PdfPCell(pageNumberPhrase) { RunDirection = PdfWriter.RUN_DIRECTION_LTR, BorderWidthLeft = 0, BorderWidthRight = 0, BorderWidthTop = 1, BorderWidthBottom = 0, Padding = 4, BorderColorTop = new BaseColor(System.Drawing.Color.LightGray), HorizontalAlignment = Element.ALIGN_RIGHT }; var totalPagesNumberImagePdfCell = new PdfPCell(data.TotalPagesCountImage) { RunDirection = PdfWriter.RUN_DIRECTION_LTR, BorderWidthLeft = 0, BorderWidthRight = 0, BorderWidthTop = 1, BorderWidthBottom = 0, Padding = 4, PaddingLeft = 0, BorderColorTop = new BaseColor(System.Drawing.Color.LightGray), HorizontalAlignment = Element.ALIGN_LEFT }; table.AddCell(datePdfCell); table.AddCell(nullPdfCell); table.AddCell(pageNumberPdfCell); table.AddCell(totalPagesNumberImagePdfCell); return table; }
/// <summary> /// Defines custom footer of the each page. /// </summary> /// <param name="pagesFooterBuilder">Pages Footer Builder</param> /// <returns></returns> public PdfReport PagesFooter(Action<PagesFooterBuilder> pagesFooterBuilder) { var builder = new PagesFooterBuilder(this); pagesFooterBuilder(builder); return this; }
private static PdfGrid createFooter01(PagesFooterBuilder footer, string date, FooterData data) { string szMsg = ""; Paragraph title = null; Font times01 = FontFactory.GetFont("helvetica-bold", 10, BaseColor.BLACK); Font times02 = FontFactory.GetFont("helvetica-bold", 10, Font.ITALIC, BaseColor.BLACK); Font times03 = FontFactory.GetFont("helvetica-bold", 10, Font.UNDERLINE, BaseColor.BLACK); Font times04 = FontFactory.GetFont("helvetica", 10, BaseColor.BLACK); Font times05 = FontFactory.GetFont("helvetica", 10, Font.UNDERLINE, BaseColor.BLACK); Font times06 = FontFactory.GetFont("helvetica", 8, BaseColor.BLACK); var table = new PdfGrid(numColumns: 4) { WidthPercentage = 100, RunDirection = PdfWriter.RUN_DIRECTION_LTR }; PdfPCell nestingcell = null; PdfPCell hlpCel = null; //First Row Sales Amount PdfPTable nested = new PdfPTable(numColumns: 3); nested.SetTotalWidth(new float[] { 390.6f, 83.6f, 64.2f }); nested.LockedWidth = true; szMsg = string.Format("Notes:"); title = new Paragraph(szMsg, times06); hlpCel = new PdfPCell(title); hlpCel.RunDirection = PdfWriter.RUN_DIRECTION_LTR; hlpCel.BorderWidthLeft = 0; hlpCel.BorderWidthRight = 0; hlpCel.BorderWidthTop = 0; hlpCel.BorderWidthBottom = 0; hlpCel.PaddingTop = 4; hlpCel.PaddingLeft = 0; hlpCel.PaddingRight = 0; hlpCel.PaddingBottom = 1; //BorderColorTop = new BaseColor(System.Drawing.Color.LightGray), hlpCel.HorizontalAlignment = Element.ALIGN_LEFT; nested.AddCell(hlpCel); szMsg = string.Format("Sales Amount:"); title = new Paragraph(szMsg, times02); hlpCel = new PdfPCell(title); hlpCel.RunDirection = PdfWriter.RUN_DIRECTION_LTR; hlpCel.BorderWidthLeft = 0; hlpCel.BorderWidthRight = 0; hlpCel.BorderWidthTop = 0; hlpCel.BorderWidthBottom = 0; hlpCel.PaddingTop = 4; hlpCel.PaddingLeft = 0; hlpCel.PaddingRight = 0; hlpCel.PaddingBottom = 1; //BorderColorTop = new BaseColor(System.Drawing.Color.LightGray), hlpCel.HorizontalAlignment = Element.ALIGN_LEFT; nested.AddCell(hlpCel); szMsg = string.Format("{0}", "96.85"); title = new Paragraph(szMsg, times02); hlpCel = new PdfPCell(title); hlpCel.RunDirection = PdfWriter.RUN_DIRECTION_LTR; hlpCel.BorderWidthLeft = 0; hlpCel.BorderWidthRight = 0; hlpCel.BorderWidthTop = 0; hlpCel.BorderWidthBottom = 0; hlpCel.PaddingTop = 4; hlpCel.PaddingLeft = 0; hlpCel.PaddingRight = 0; hlpCel.PaddingBottom = 1; //BorderColorTop = new BaseColor(System.Drawing.Color.LightGray), hlpCel.HorizontalAlignment = Element.ALIGN_RIGHT; nested.AddCell(hlpCel); nestingcell = new PdfPCell(nested); nestingcell.Colspan = 4; nestingcell.RunDirection = PdfWriter.RUN_DIRECTION_LTR; nestingcell.BorderWidthLeft = 0; nestingcell.BorderWidthRight = 0; nestingcell.BorderWidthTop = 0; nestingcell.BorderWidthBottom = 0; nestingcell.Padding = 0; //BorderColorTop = new BaseColor(System.Drawing.Color.LightGray), nestingcell.HorizontalAlignment = Element.ALIGN_CENTER; table.AddCell(nestingcell); //Second Row Sales Amount PdfPTable nested01 = new PdfPTable(numColumns: 2); nested01.SetTotalWidth(new float[] { 390.6f, 147.8f }); nested01.LockedWidth = true; szMsg = string.Format("{0}", "The note goes here !! (Use 4 rows)"); title = new Paragraph(szMsg, times04); hlpCel = new PdfPCell(title); hlpCel.RunDirection = PdfWriter.RUN_DIRECTION_LTR; hlpCel.BorderWidthLeft = 0; hlpCel.BorderWidthRight = 0; hlpCel.BorderWidthTop = 0; hlpCel.BorderWidthBottom = 0; hlpCel.PaddingTop = 1; hlpCel.PaddingLeft = 0; hlpCel.PaddingRight = 0; hlpCel.PaddingBottom = 1; //BorderColorTop = new BaseColor(System.Drawing.Color.LightGray), hlpCel.HorizontalAlignment = Element.ALIGN_LEFT; nested01.AddCell(hlpCel); PdfPTable nested02 = new PdfPTable(numColumns: 2); nested02.SetTotalWidth(new float[] { 83.6f, 64.2f }); nested02.LockedWidth = true; szMsg = string.Format("Tax {0} %:", " "); title = new Paragraph(szMsg, times04); hlpCel = new PdfPCell(title); hlpCel.RunDirection = PdfWriter.RUN_DIRECTION_LTR; hlpCel.BorderWidthLeft = 0; hlpCel.BorderWidthRight = 0; hlpCel.BorderWidthTop = 0; hlpCel.BorderWidthBottom = 0; hlpCel.PaddingTop = 1; hlpCel.PaddingLeft = 0; hlpCel.PaddingRight = 0; hlpCel.PaddingBottom = 1; //BorderColorTop = new BaseColor(System.Drawing.Color.LightGray), hlpCel.HorizontalAlignment = Element.ALIGN_LEFT; nested02.AddCell(hlpCel); szMsg = string.Format("{0}", "0.00"); title = new Paragraph(szMsg, times04); hlpCel = new PdfPCell(title); hlpCel.RunDirection = PdfWriter.RUN_DIRECTION_LTR; hlpCel.BorderWidthLeft = 0; hlpCel.BorderWidthRight = 0; hlpCel.BorderWidthTop = 0; hlpCel.BorderWidthBottom = 0; hlpCel.PaddingTop = 1; hlpCel.PaddingLeft = 0; hlpCel.PaddingRight = 0; hlpCel.PaddingBottom = 1; //BorderColorTop = new BaseColor(System.Drawing.Color.LightGray), hlpCel.HorizontalAlignment = Element.ALIGN_RIGHT; nested02.AddCell(hlpCel); szMsg = string.Format("Shipping & Handling:", " "); title = new Paragraph(szMsg, times04); hlpCel = new PdfPCell(title); hlpCel.RunDirection = PdfWriter.RUN_DIRECTION_LTR; hlpCel.BorderWidthLeft = 0; hlpCel.BorderWidthRight = 0; hlpCel.BorderWidthTop = 0; hlpCel.BorderWidthBottom = 0; hlpCel.PaddingTop = 1; hlpCel.PaddingLeft = 0; hlpCel.PaddingRight = 0; hlpCel.PaddingBottom = 1; //BorderColorTop = new BaseColor(System.Drawing.Color.LightGray), hlpCel.HorizontalAlignment = Element.ALIGN_LEFT; nested02.AddCell(hlpCel); szMsg = string.Format("{0}", "21.00"); title = new Paragraph(szMsg, times04); hlpCel = new PdfPCell(title); hlpCel.RunDirection = PdfWriter.RUN_DIRECTION_LTR; hlpCel.BorderWidthLeft = 0; hlpCel.BorderWidthRight = 0; hlpCel.BorderWidthTop = 0; hlpCel.BorderWidthBottom = 0; hlpCel.PaddingTop = 1; hlpCel.PaddingLeft = 0; hlpCel.PaddingRight = 0; hlpCel.PaddingBottom = 1; //BorderColorTop = new BaseColor(System.Drawing.Color.LightGray), hlpCel.HorizontalAlignment = Element.ALIGN_RIGHT; nested02.AddCell(hlpCel); hlpCel = new PdfPCell(nested02); hlpCel.RunDirection = PdfWriter.RUN_DIRECTION_LTR; hlpCel.BorderWidthLeft = 0; hlpCel.BorderWidthRight = 0; hlpCel.BorderWidthTop = 0; hlpCel.BorderWidthBottom = 0; hlpCel.PaddingTop = 1; hlpCel.PaddingLeft = 0; hlpCel.PaddingRight = 0; hlpCel.PaddingBottom = 1; //BorderColorTop = new BaseColor(System.Drawing.Color.LightGray), hlpCel.HorizontalAlignment = Element.ALIGN_CENTER; nested01.AddCell(hlpCel); nestingcell = new PdfPCell(nested01); nestingcell.Colspan = 4; nestingcell.RunDirection = PdfWriter.RUN_DIRECTION_LTR; nestingcell.BorderWidthLeft = 0; nestingcell.BorderWidthRight = 0; nestingcell.BorderWidthTop = 0; nestingcell.BorderWidthBottom = 0; nestingcell.Padding = 0; //BorderColorTop = new BaseColor(System.Drawing.Color.LightGray), nestingcell.HorizontalAlignment = Element.ALIGN_CENTER; table.AddCell(nestingcell); //Page counter var datePhrase = footer.PdfFont.FontSelector.Process(date); var datePhrase01 = footer.PdfFont.FontSelector.Process(" "); var datePdfCell = new PdfPCell(datePhrase01) { RunDirection = PdfWriter.RUN_DIRECTION_LTR, BorderWidthLeft = 0, BorderWidthRight = 0, BorderWidthTop = 1, BorderWidthBottom = 0, Padding = 4, BorderColorTop = new BaseColor(System.Drawing.Color.LightGray), HorizontalAlignment = Element.ALIGN_CENTER }; var nullPdfCell = new PdfPCell { RunDirection = PdfWriter.RUN_DIRECTION_LTR, BorderWidthLeft = 0, BorderWidthRight = 0, BorderWidthTop = 1, BorderWidthBottom = 0, Padding = 4, BorderColorTop = new BaseColor(System.Drawing.Color.LightGray), HorizontalAlignment = Element.ALIGN_RIGHT }; var pageNumberPhrase = footer.PdfFont.FontSelector.Process("Page " + data.CurrentPageNumber + " of "); var pageNumberPdfCell = new PdfPCell(pageNumberPhrase) { RunDirection = PdfWriter.RUN_DIRECTION_LTR, BorderWidthLeft = 0, BorderWidthRight = 0, BorderWidthTop = 1, BorderWidthBottom = 0, Padding = 4, BorderColorTop = new BaseColor(System.Drawing.Color.LightGray), HorizontalAlignment = Element.ALIGN_RIGHT }; var totalPagesNumberImagePdfCell = new PdfPCell(data.TotalPagesCountImage) { RunDirection = PdfWriter.RUN_DIRECTION_LTR, BorderWidthLeft = 0, BorderWidthRight = 0, BorderWidthTop = 1, BorderWidthBottom = 0, Padding = 4, PaddingLeft = 0, BorderColorTop = new BaseColor(System.Drawing.Color.LightGray), HorizontalAlignment = Element.ALIGN_LEFT }; table.AddCell(datePdfCell); table.AddCell(nullPdfCell); table.AddCell(pageNumberPdfCell); table.AddCell(totalPagesNumberImagePdfCell); return table; }