This is an archived forum post. The information may be outdated. Contact us if you have any questions.

Get the Page Number while converting the html to pdf

nitish_developer wrote on 2013-01-25:
Dear Support,

I am using C# lang. with ASP.NET , please help me to get the page number as i want to create a report where the report is divided into 30 sections and i want to get 6 sections on the odd page and rest on the next page. Please help me asap.
support wrote on 2013-01-25:

What do you mean by "get the page number"? The API provides neither the information about the total number of pages in PDF nor about the current page number.

Please describe what you want to achieve in greater detail (an example would be great) and perhaps we can advise.
nitish_developer wrote on 2013-01-28:
I want to print a Software report like the

Page Number 1 -- first page of the book.

Page Number 2 - second page od the book.

Actually, I am generating the PDF weith the index portion of book so, i want to print the page number at the bottom. Here is the sample screen shot that i am attaching for the clarification.

Furthermore, witht the use of your pdf convertor, i am unable to design the book like the attached sample.

Any help for the second point will be greatly appreciated,
support wrote on 2013-01-28:
You can use the setFooterHtml() API function to insert a page number into a PDF footer. A php example:
$client->setFooterHtml("Page %p of %n");

The %p variable expands to the current page number and %n expands to the total number of pages.

As for the screenshot, I'm not able to open it, please send it to
nitish_developer wrote on 2013-01-30:
can you provide me the page number code for the in lang. C#. As when i use the %p, it is not displaying the page number.

thanks for the help ..!!!!!

Happy Programming :)
support wrote on 2013-01-30:
Here it is in C#:
client.setFooterHtml("Page %p of %n");

Please note that the %p variable is not expanded in a string passed to convertHtml(). It is expanded only in these functions: setFooterHtml(), setFooterUrl(), setHeaderHtml(), and setHeaderUrl().
nitish_developer wrote on 2013-01-31:
I have used the same code but i am unable to print the page number .

Here is my code :-

client.setFooterHtml("<hr/><p style='align:left;width:40%'>Agraneeh karmic Power Ltd. Page Number %p</p> ");
support wrote on 2013-02-04:
Your header is too narrow for one row. Either widen it from 40% to 100%:
client.setFooterHtml("<hr/><p style='align:left;width:100%'>Agraneeh karmic Power Ltd. Page Number %p</p>");

Or increase the margin height:
client.setFooterHtml("<hr/><p style='align:left;width:40%'>Agraneeh karmic Power Ltd. Page Number %p</p>");
kuldeepte wrote on 2016-09-29:
I am getting nothing while converting my code as below:

client.convertURI("", Stream);

client.setFooterUrl("<hr/><p style='align:left;width:40%'>Test Page Number %p</p>");