I'm looking to Concat/Merge multiple PDFs into one PDF. Each original PDF needs to start on a new page in the final PDF. In addition, I need to add a footer to each page of the final PDF that has a file identifier on the left, Page X of Y in the center, and time stamp on the right. When using iTextSharp, I could use a PDFWriter, modify the Page Event Handler, and create a footer table. Is this the simplest way to create the footer? When I built a table, I'm having issue with the total number of the "Page X of Y". How do you generate the Y in a table?
public override void OnEndPage(PdfWriter writer, Document doc)
{
PdfPTable footerTable = new PdfPTable(3);
footerTable.TotalWidth = doc.PageSize.Width;
footerTable.HorizontalAlignment = Element.ALIGN_CENTER;
Paragraph documentID = new Paragraph("Document ID: " + docID, footer);
Paragraph pageNumbers = new Paragraph("Page " + writer.PageNumber.ToString() + " of " + **Y**, footer);
Paragraph time = new Paragraph(timeStamp, footer);
}
As for using PDFWriter to merge the documents, will it give me a page break at the start of each document that is next to be written to the final PDF?