public override void OnEndPage(PdfWriter writer, Document document)
{
base.OnEndPage(writer, document);
if (_isLastPage)
{
var relativeWidths = ColumnsHelper.GetRelativeColumnsForProducts(PageSize.A4);
//RODAPE
var pdfTableFooter = new BuilderTable().Create(relativeWidths).Standard();
pdfTableFooter.AddCell(new BuilderCell("", 5).Create("DADOS ADICIONAIS").FixedHeight(15).Bold().HorizontalLeft().VerticalBottom().Colspan(42).NoBorder().BorderBuilder(false, false, false, false).Standard());
pdfTableFooter.AddCell(new BuilderCell("", 5).Create("INFORMAÇÕES COMPLEMENTARES").FixedHeight(5).Bold().HorizontalLeft().VerticalTop().Colspan(32).NoBorder().BorderBuilder(true, true, false, true).Standard());
pdfTableFooter.AddCell(new BuilderCell("", 5).Create("RESERVADO AO FISCO").Bold().HorizontalLeft().VerticalTop().Colspan(10).NoBorder().BorderBuilder(true, true, false, true).Standard());
var infAdicional = _nfe.NFe.infNFe.infAdic;
pdfTableFooter.AddCell(new BuilderCell("", 5).Create(infAdicional.infCpl).FixedHeight(25).HorizontalLeft().VerticalTop().Colspan(32).NoBorder().BorderBuilder(true, true, false, false).Standard());
pdfTableFooter.AddCell(new BuilderCell("", 5).Create(" ").HorizontalLeft().VerticalTop().Colspan(10).NoBorder().BorderBuilder(true, true, false, false).Standard());
if (_isHomolog)
{
pdfTableFooter.AddCell(new BuilderCell("", 5).Create("SEM VALOR FISCAL").FixedHeight(5).HorizontalLeft().VerticalTop().Colspan(32).NoBorder().BorderBuilder(true, true, true, false).Standard());
pdfTableFooter.AddCell(new BuilderCell("", 5).Create(" ").HorizontalLeft().VerticalTop().Colspan(10).NoBorder().BorderBuilder(true, true, true, false).Standard());
}
document.Add(pdfTableFooter);
}
const float posX = 325f;
const float posY = 662f;
var pageN = writer.PageNumber;
var text = "Folha " + pageN + "/";
var len = _baseFont.GetWidthPoint(text, 8);
_pdfContent = writer.DirectContent;
_pdfContent.SetRGBColorFill(100, 100, 100);
_pdfContent.BeginText();
_pdfContent.SetFontAndSize(_baseFont, 8f);
_pdfContent.SetTextMatrix(posX, posY);
_pdfContent.ShowText(text);
_pdfContent.EndText();
_pdfContent.AddTemplate(_pageNumberTemplate, posX + len, posY);
_pdfContent.BeginText();
_pdfContent.SetFontAndSize(_baseFont, 8f);
_pdfContent.EndText();
}