Dude, What’s My Last Page?

You’re creating the annual report, and you think it might be nice to let the readers know just how many more pages of that boring 6-point financial drivel they’re going to have to wade through. So you want to add the total number of pages to the page number in the footer: e.g., Page 1 of 128.
On the master page, you very cleverly type “Page [Insert Special Character>Markers>Current Page Number] of 128.”
But you know what’s going to happen, don’t you? The CEO wants to expand his impressive bio, the marketing manager wants to add a section on the new plant in Tierra del Fuego, and photos of the 28 new hires have to be added. Now you’re up to 136 pages, so you change 128 to 136 on the master. But wait—the assistant marketing manager wants to bump up the text size for older readers, so now you’re up to 152.
Then here comes the VP of Facilities Management: “Let’s add a center section with floor plans of all our locations—that would be, oh, we don’t know how many pages.” Okay, this isn’t fun any more. Argh. There has to be a better way to control the page numbers.
And there is!
Instead of manually entering the number of total pages, let InDesign do it for you, using a variable. Variables are generated text, created by InDesign. There are predefined variables for uses such as Chapter Number and Modification Date, and you can define custom variables, too. And—lucky you—there’s a variable that solves this problem.
On the master page, just use the variable for the total page count: Type>Text Variables>Insert Variable>Last Page Number. Now the page count will automatically update when you add or delete pages. (It will look odd on the master page: “Page A of 1,” but don’t freak out.)
Note: If you’ve created sections in the document, the Last Page Number variable will track only the last page number within each section. For example, if a 24-page document consists of two sections, i–iv and 1-20, the Last Page Number variable will result in the first section’s cumulative page number displaying as “i of iv,” and the second section will display “1 of 20.” This doesn’t make my right eye twitch, but it’s worth mentioning.
This article was last modified on December 30, 2021
This article was first published on August 17, 2013
Idealny wpis, generalnie to ma sens, jednakże w kilku kwestiach bym się kłóciła.
Z pewnością ten blog zasługuje na uznanie. Myślę, że
tu wrócę.
Hi.
how can I get the Total page number with the script?
Such a useful tidbit of information! I knew there had to be something like this but I kept looking under Special Characters and never paid any attention to Text Variables!
This article was super helpful. I didn’t know InDesign had variables till now and I’ve worked in this program for over 2 years!
LOVe the way you write
This is awesome. Thank you