Esempio n. 1
0
        /// <summary>
        /// Fires when a page is finished, just before being written to the document.
        /// </summary>
        /// <param name="writer">PdfWriter</param>
        /// <param name="document">PDF Document</param>
        /// <param name="columnCellsSummaryData">List of all rows summaries data</param>
        public void PageFinished(PdfWriter writer, Document document, IList <SummaryCellData> columnCellsSummaryData)
        {
            var footerTable = AddPageFooter(new FooterData
            {
                PdfDoc               = document,
                PdfWriter            = writer,
                SummaryData          = columnCellsSummaryData,
                CurrentPageNumber    = writer.PageNumber,
                TotalPagesCountImage = _totalPageCountImage
            });

            var table = new PdfGrid(1)
            {
                RunDirection    = (int)FooterProperties.RunDirection,
                WidthPercentage = FooterProperties.TableWidthPercentage
            };
            var tableCell = new PdfPCell(footerTable)
            {
                Border = 0
            };

            table.AddCell(tableCell);

            var page = document.PageSize;

            table.SetTotalWidth(new[] { page.Width - document.LeftMargin - document.RightMargin });
            table.WriteSelectedRows(
                rowStart: 0,
                rowEnd: -1,
                xPos: document.LeftMargin,
                yPos: document.BottomMargin - FooterProperties.SpacingBeforeTable,
                canvas: writer.DirectContent);
        }