Free Support Forum -

Replaceable symbol ($p of $P) Issue

Hi All, I have a problem with replacable symbol in pdf, I need to put at the footer for each secction te test PAGE: 5 of 50 for instance. For this I use this aproach below:

// Create a Footer Section of the document

Aspose.Pdf.Generator.HeaderFooter footer = new Aspose.Pdf.Generator.HeaderFooter(mainSection);

// set the Odd footer of the PDF file

mainSection.OddFooter = footer;

// set the Even footer of the PDF file

mainSection.EvenFooter = footer;

// Create a Text object

Aspose.Pdf.Generator.Text txt = new Aspose.Pdf.Generator.Text("Page: ($p of $P) ");

TextInfo txtFooterInfo = new Aspose.Pdf.Generator.TextInfo();

txtFooterInfo.Alignment = AlignmentType.Center;

txt.Margin = new MarginInfo();

txt.Margin.Bottom = 50F;

txt.TextInfo = txtFooterInfo;

// Add text to Header section of the Pdf file


The problem is that only get the current page ($p) and aspose not replace $P parameter with the total of pages.

A little search I discover a Issue but the date of this is the year 2008 I bilive you already solve this, My Aspose version is: 7.4.

Could you give me some light on this?



Ok, This is solve if you use this format

"Page $p of $P "

But I dont't know if this is a Aspose issue.



Hi Diego,

We already have investigated this issue and in order to properly display the total page count using $P, there should be a blank space after $P so that its rendered properly. During our investigations, we could not find any suitable solution except for this workaround. We are sorry for this inconvenience.

Hi, thanks, but also you need to update the aspose examples like this



Hi Diego,

Thanks for sharing the information. I have updated the documentation topic.