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

Free Support Forum - aspose.com

Footer page numbers

How can I create a footer with the Page number on the left hand side and the date/time on the right hand side on the same line. I used the following code but text is on two lines. I tried to using a table with two cells, but how can I get table to autosize to page width for portrait and landscape pages.

Text = "Page No: "
Builder.InsertField("PAGE", "")
Builder.ParagraphFormat.Alignment = ParagraphAlignment.Left
Text = "Created on: " & Now.ToString("dd/MM/yyyy hh:mm:ss")
Builder.ParagraphFormat.Alignment = ParagraphAlignment.Right

That is a very good question. It was asked several times on the forum so I guessed it was a time to put the answer in our Wiki. The article is now available on the following link:


Please review it and let me know if it covers all that you wished to know about dynamic headers/footers creation.

The code example given in the article should also solve the problem submitted in your ‘DifferentFirstPageHeaderFooter’ post.

Please use the updated version of the code in


The update eliminates some problems that can arise when exporting the created headers/footers to PDF or HTML.

Best regards,