Hi,
I’m using Apose.Pdf for C#.NET. I’m trying to add headers and footers to every page in my document, where the headers and footers can contain a left part, a right part and a center part. I’ve seen info on your documentation and in forums that says I should do this using a table. My code is below for inserting a table into the footer with three columns. When I view the document, I can only see the top border of the table, and nothing more. Also, I can only see this on the first page. On all other pages I see nothing in the footer. I have tried changing the margins but this seems to make no difference. How can I make my table visible in the footer? Thanks.
public Document AddFooter(MemoryStream stream)
{
var pdf = new Document(stream);
HeaderFooter footer = new HeaderFooter();
var tab1 = new Table();
//Add the table in paragraphs collection of the desired section
footer.Paragraphs.Add(tab1);
//Set with column widths of the table
tab1.ColumnWidths = "150 150 150";
tab1.DefaultCellBorder = new BorderInfo(BorderSide.All, .5F, Color.Gray);
//Create rows in the table and then cells in the rows
var row1 = tab1.Rows.Add();
row1.Cells.Add();
row1.Cells.Add();
row1.Cells.Add();
row1.Cells[0].Alignment = HorizontalAlignment.Left;
row1.Cells[1].Alignment = HorizontalAlignment.Center;
row1.Cells[2].Alignment = HorizontalAlignment.Right;
row1.Cells[0].Paragraphs.Add(new HtmlFragment("<p>right</p>"));
row1.Cells[1].Paragraphs.Add(new HtmlFragment("<p>center</p>"));
row1.Cells[2].Paragraphs.Add(new HtmlFragment("<p>left</p>"));
foreach (Page pdfPage in pdf.Pages)
{
pdfPage.Footer = footer;
pdfPage.PageInfo.Margin.Bottom = 80;
}
return pdf;
}