iTextSharp.text.Image footerImage = new Quote().GetFooter();
Rectangle page = document.PageSize();
PdfPTable foot = new PdfPTable(1);
foot.DefaultCell.BorderWidth = 0;
foot.DefaultCell.BorderColorBottom = new Color(255, 255, 255);
foot.AddCell(footerImage);
foot.TotalWidth = page.Width - document.LeftMargin - document.RightMargin;
foot.WriteSelectedRows(0, -1, document.LeftMargin, foot.TotalHeight - 7, writer.DirectContent);
2 comments:
The code you posted worked for Java I guess, but I used it in C# and with a few fixed It worked the way I wanted, thanks.
In case it helps, here is my C# version.
public void PlaceFooter()
{
Rectangle page = doc.PageSize;
PdfPTable EndTable = CreatePlacementTable(false, 100);
EndTable.DefaultCell.Padding = 2f;
EndTable.HorizontalAlignment = Element.ALIGN_JUSTIFIED;
//Add anything you want into this EndTable
EndTable.AddCell("This is my footer");
EndTable.TotalWidth = page.Width - doc.LeftMargin - doc.RightMargin;
EndTable.WriteSelectedRows(0, -1, doc.LeftMargin, EndTable.TotalHeight + doc.marginBottom, writer.DirectContent);
}
Post a Comment