We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Add a table at the end of Pdf document using Aspose.PDF for .NET

I am trying to achive a Table of Signatures at the end of a pdf document already with content:

table line 1: person 1 image | space | person 2 image

(person 1 name) (Person 2 name)

table line 2: person 3 image | space | person 4 image

(person 3 name) (Person 4 name)

I already build the table, but i am with problems in the way to add the table at the end of a pdf document, how should i find the end of the document to add the table (if necessary the table lines should continue to a new page, if not fit in the last page of pdf.)?

(for now i am adding a new page with signatures, but the requirement is to start the table at the end of the document if it fits the last page):

using (Document document = new Document(inputFileMemStream))

{

Page lastpage = document.Pages.Add(); 

Table table = new Table();

table.Top = 100;

table.ColumnWidths = “180 20 180”;

lastpage.Paragraphs.Add(table);

int count = 0;

Row row = new Row();

Cell cell;

foreach (RCSignatureRecord sig in ssSignaturesList)

{

count = count + 1;

if (count % 2 != 0) //even

{

row = table.Rows.Add();

}

cell = row.Cells.Add();

Image image = new Image();

image.ImageStream = new MemoryStream(sig.ssSTSignature.ssImage);

TextFragment name_fragment = new TextFragment(sig.ssSTSignature.ssName);

cell.Alignment = HorizontalAlignment.Center;

cell.Paragraphs.Add(image);

cell.Paragraphs.Add(name_fragment);

if (count % 2 != 0) //even //space column

{

cell = row.Cells.Add();

}

}

MemoryStream temp = new MemoryStream();

document.Save(temp);

Hi Marco,


Thanks for your inquiry. I am afraid currently Aspose.Pdf does not support to find position of last element on the page. So after initial investigation we have logged a ticket PDFNEWNET-39660 in our issue tracking system for the purpose. We will keep you updated about the issue resolution accordingly.

We are sorry for the inconvenience caused.

Best Regards,