Can I add page number to PDF footer using html2any command line?


My company bought your solution for our client in order to create PDF file from HTML file and it works great.

I received a new demand from our client to add page number (and total pages) to each of the PDF files that generated by the product.

Is it possible to add the page number to the page footer as requested? If so, please send me the command that I need to add.

I will appreciate that you send me all possibilities like page number, total pages and page of pages.

Currently I am activating the product by using the following command line:

html2any htmlName.html pdfFolder/myPdfName.PDF

Thank you for your help,
You can use following options to add the header and footer,

-hfflag <string> : set HTML header/footer to off or on
-header <string> : set HTML header text
-footer <string> : set HTML footer text


html2any.exe -hfflag on -header "HTML Header" -footer "HTML Footer"


This solution will work in static header/footer but the page footer need to have page number that is dynamic content.

I will appreciate if you give me clear answer because I have to answer my client if his demand can be done.

Thank you.
You can use &p and &P to control the dynamic page number, for example,

html2any.exe -hfflag on -header "&p of &P" -footer "&p of &P"

html2any is support all Headers and Footers which supported by Internet Explorer, please refer to following web pages for more information,

Desired Text Code
Window title &w
Page address (URL) &u
Date in short format (as specified by Regional Settings in Control Panel) &d
Date in long format (as specified by Regional Settings in Control Panel) &D
Time in the format specified by Regional Settings in Control Panel &t
Time in 24-hour format &T
Current page number &p
Total number of pages &P
Centered text (following &b) &b
Right-aligned text (following &b&b) &b&b
A single ampersand (&) &&


VN:F [1.9.20_1166]
Rating: 0.0/10 (0 votes cast)
VN:F [1.9.20_1166]
Rating: 0 (from 0 votes)

Related Posts

Leave a Reply

Your email address will not be published. Required fields are marked *

Verify Code   If you cannot see the CheckCode image,please refresh the page again!