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

Free Support Forum - aspose.com

Remove Footer from Last Page


We have a document which have a signature text in the footer of each page, we would like to show the signature on the footer of each page except the last one, how could we accomplish this scenario?

Note: We have added the signature to the footer because we have a long text which fits to multiple. This is the way we know for repeating something in each page regardless of the page content.
Hi Ahemd,

Thanks for your inquiry. You can use IF field with PAGE and NUMPAGES fields as shown below to get the desired output. PAGE field represents number of current page while NUMPAGES represents the number of pages in document. You can make use of IF field in footer to detect last page e.g.

{ IF "{PAGE}" <> "{NUMPAGES}" "signature text" "" }

Hope this helps you. Please let us know if you have any more queries.

Document doc = new Document();

DocumentBuilder builder = new DocumentBuilder(doc);


// { IF "{PAGE}" <> "{NUMPAGES}" "signature text" "" }

Field field = builder.InsertField("IF \"", null);


builder.InsertField("PAGE", null);

builder.Write("\" <> \"");

builder.InsertField("NUMPAGES", null);

builder.Write("\" \"");

BookmarkStart bmTrue = builder.StartBookmark("bmTrue");


builder.Write("\" \"");

BookmarkStart bmFalse = builder.StartBookmark("bmFalse");


builder.Write("\" ");

builder.MoveToBookmark("bmTrue", true, true);

builder.Write("signature text");




for (int i = 0; i < 4; i++)





doc.Save(MyDir + @"17.6.docx");

Hello Tahir,

Thanks alot for your prompt support, I thought about this idea, but the footer isn’t simply a text, it’s a table , can we do that with the formula you suggested ?
Hi Ahemd,

Thanks for your inquiry. Yes, you can use this approach with table also. If you face any issue, please share your input document here for our reference. We will then share the code example according to your requirement.