Skip to main content
Participant
December 12, 2023
Answered

How to add both book current page / total pages AND the file current page / total pages to header

  • December 12, 2023
  • 3 replies
  • 294 views

I have a situation where I need to show two sets of page numbers in the header of some of the files in my book. I need to show the book's current page and total pages. That is pretty straigtforward. I also, in the same header, need to show this .fm file's current page and total pages.  For example:

Page 13 of 43

Attahment 1

Page 1 of 3

 

Any suggestions? Thanks!

    This topic has been closed for replies.
    Correct answer frameexpert

    Here is a 6 and a half minute video that shows a scripting solution to this poster's request:

    https://youtu.be/h7lYpT54PSA

    3 replies

    frameexpert
    Community Expert
    frameexpertCommunity ExpertCorrect answer
    Community Expert
    December 14, 2023

    Here is a 6 and a half minute video that shows a scripting solution to this poster's request:

    https://youtu.be/h7lYpT54PSA

    Community Expert
    December 13, 2023

    Hi,

    The current page of the book is <$curpagenum>.

    The last page of the book is <$totalpagesinabook>.

    Only the current and last page of the current files are difficult to get. You want that the page numbering starts with the firt page of the file. As you set the page numbering in the numbering settings of your file only (probably continue page numbering from previous file), you cannot set another page numbering scheme.

    Then you can use a hack like that which Bob described. For the numbering of the last page you might insert a cross-reference to the numbered paragraph on the last last page. It could be that you have to update this cross-reference manually, when the number of pages changes, so that the cross-reference always links to the paragraph on the last page.

    Of course you can automate everything with ExtendScript.

    Best regards, Winfried

    frameexpert
    Community Expert
    Community Expert
    December 13, 2023

    The <$lastpagenum> building block is the last page of the current document. So the only one you need is the current page number in the context of the entire book. If I were to script this, I would use calculate the starting page number of each component in context of the entire book. Then, for each document, I would use a Running H/F marker on each page to indicate it's page number in the context of the book. The script could be run automatically whenever you update the book.

    Community Expert
    December 13, 2023

    Unfortunately <$lastpagenum> is the last page number of the file in the book and not the total number of pages of the file.

    Therefore you still need a solution for the last page number of the current file.

    Bob_Niland
    Community Expert
    Community Expert
    December 12, 2023

    As a quick hack, I might do this as some hidden text on each page that sports an autonumbered para; one instance per page. The trick is how to anchor it so that you get one, and only one, per page. The RHFs could then pick that up.

    And if I did it this way, I'd be tempted to add a small Flow P text frame to the Master Pages. The frame only needs to be one line high, and contain only the AN para, in some color turned off for publication via Color Views. Just make sure that the frame isn't empty on any pages.