Adding Page Numbers to the Footer in Google Docs

I love Google Docs. I use it all the time for just about everything from writing articles to formatting ebooks.

But when working on ebooks, I always had to download them into Open Office before exporting them as PDFs to add page numbers in the footer.

Then someone sent me link to their Google Doc file to help them with, and when I PDFed it to print out, IT HAD PAGE NUMBERS! Ok, maybe you’re not as excited as I was, but it really doesn’t take much to make me giddy.

I figured I had missed a menu item, so I wasted an inordinate amount of time looking for anything in the menu system of Google Docs that might add a page number.

No luck. But then under the edit menu, I unexpectedly hit upon the answer. I clicked on Edit HTML and scrolled down to the bottom of the document, and there it was… span tags that will magically add page numbers, and/or a total page count to each page of your PDF when it’s exported.

Inside the DIV tag with the class=google_footer you can include one or both of these tags:
<span class=”google_pagenumber”>1</span>
(which will show the actual page number on your PDF, even though there’s a number 1 inside the tags.)
<span class=”google_pagecount”>1</span>
(which once again needs a 1 there in the document, but will actually show how many pages are in your document when it’s exported as a PDF.

So, if you wanted to add Page 5 of 150, for example, in your footer, you would add :
Page <span class=”google_pagenumber”>1</span> of <span class=”google_pagecount”>1</span>
in the footer.

While your fiddling with the HTML anyway, you can style the footer Div with a border-top or background color, or other neato stuff.

I used Google Docs to create the entire PDF I’m giving away as a newsletter signup bonus at

The page numbers showed up great. Now if only I could get the TOC to work reliably, I’d love Google forever.

One comment

  1. Mihkel Putrinš says:

    And HTML view is not there any more…
    Interesting, what happens with documents with custom HTML in new environment?

%d bloggers like this: