The following code is a sample of a Visualforce page that rendered as PDF with Footer and Page counter in the center.
Line 4-18 is an internal CSS style sheet for the footer and the page number.
After the @page definition, we can add the information to the footer inside with class=”footer”. The “footer” class will set the content inside the to the bottom-center of the page and display it on every page. We also added <span id="pageNum"/> which shows the page number after the company information.
If you use a combination of a Visualforce page and a Visualforce component, we recommend that you add the <div> with “footer” class in the Visualforce page as shown in the sample above, so the footer will always stay in the bottom of the page.
Now you can try to create a page with a header. To do so, just change line#8 from “@bottom-center” to “@top-center”. Did your content move from bottom to top of the page?