Adding a Table as a footer in PDF

Is it possible to add a table to a footer of a PDF?

We are evaluating Aspose Total for processing of PDFs for our organization and one of our groups likes to “Stamp” the bottom of documents on every page with a table that is 2 columns wide and has three rows with various content related to the document and dates.

I am able to create a footer and add a stamp to the document which works like a charm, but when I try and add a table in a similar manner it never appears.

The code I am doing seems to produce the table fine when I create a new document, add a paragraph and then add the table to the paragraph, but we would need to do this on existing documents.

So there are a variety of related questions.

  1. Can a table be added to a footer?
  2. Can a table be added as a Stamp at the bottom of the page?
  3. Is it possible to Insert a paragraph at the bottom of every page of an existing document?

From my testing, I do not think #3 is possible which kind of makes sense, but would like to confirm, I believe this is while even though I may be able to specify the position, it is hard for the application to know how to deal with any of the content that would been to be shifted, Adding this content to the bottom of every pages would likely cause a document to increase in size, for example, a 20 page document may be 28 pages with this bottom section added to every page.

To work around this, I am trying to get our group to flatten this content into a single line which I think I should be able to apply as a stamp, but would like to be able to do so with some formatting like borders on cells so it appears like a table, so either doing as a table in the footer, or having a stamp that had multiple cells will work.

Thank you


Thank you for contacting support.

You may add a table to the footer of PDF page using below code snippet in your environment:

var document = new Document();
Aspose.Pdf.HeaderFooter footer = new Aspose.Pdf.HeaderFooter();

var tab1 = new Aspose.Pdf.Table();
//Add the table in paragraphs collection of the desired section

//Set with column widths of the table
tab1.ColumnWidths = "150 150 150";
tab1.DefaultCellBorder = new BorderInfo(BorderSide.All, .5F, Aspose.Pdf.Color.Gray);

//Create rows in the table and then cells in the rows
var row1 = tab1.Rows.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 TextFragment("right"));
row1.Cells[1].Paragraphs.Add(new TextFragment("center"));
row1.Cells[2].Paragraphs.Add(new TextFragment("left"));

foreach (Aspose.Pdf.Page pdfPage in document.Pages)
    pdfPage.Footer = footer;
    pdfPage.PageInfo.Margin.Bottom = 60;
    pdfPage.PageInfo.Margin.Left = 40;

document.Save(dataDir + @"FooterTable.pdf", SaveFormat.Pdf);

Moreover, a table may not be added as a stamp on a PDF page. Whereas, TextParagraph can be added on any position of a PDF page with below code snippet:

    Document document = new Document();
    Page page = document.Pages.Add();

    TextFragment textFragment = new TextFragment();
    textFragment.Text = "Aspose";

    textFragment.Position.XIndent = 400;
    textFragment.Position.YIndent = 700;
    //create TextParagraph object
    TextParagraph par = new TextParagraph();

    //set paragraph position
    par.Position = new Position(textFragment.Position.XIndent, textFragment.Position.YIndent);

    //add new TextFragment to paragraph

    //add the TextParagraph using TextBuilder
    TextBuilder textBuilder = new TextBuilder(page);
    document.Save(dataDir + "Test_19.3.pdf");

We hope this will be helpful. Please feel free to contact us if you need any further assistance.

Hello. This code does not work for me, at least the top portion. This adds a page, then a paragraph, and then the table to that section. That I can do readily easily. But, for example, if I have a four page document and I want to add a table to the bottom of each page, can ASPOSE do that. I and still looking at the textFragment code.

It also does not look like a table can be added to a TextFragment. Is that correct?


Thank you for elaborating it further.

Would you please share a sample source PDF document so that we may investigate and assist you accordingly. Moreover, a Table may contain TextFragment but a TextFragment cannot contain a Table.

Sample Consent Form.pdf (952.2 KB)

Hopefully this comes through fine. This would be an example of that we would like to create as the FINISHED product. So picture this PDF without the table footer, or I can create one with out. The idea would be as we are processing these documents in our system, and those documents sometimes come from outside sponsors, we add things like Protocol Number, Approval Date etc. Currently they manually add these tables in Adobe DC or the table is part of a Word Document. The trick is we want this to be standard, and many of these documents come from the outside, so we cannot dictate the format of the document.

So for what we envision, we would get a document and be adding this footer table on every page.

So that was where the idea came that if we flattened the table and added some borders, we could do as a one line table as a footer. Through all of my attempts though, it does not look like I can put a table in a footer and it shows up.

Stamp form this conversation does not seem to take a table

Alternatively, if a table exists in a PDF like this, what is the easiest way for interacting and perhaps updating data?


Thank you for sharing the PDF document as your expected output. Please also share a source document with us so that we may investigate further. Moreover, you may work with TableAbsorber class to edit table contents as explained in Manipulate tables in existing PDF.