Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
0

Providing Absolute Page Number and Sectional Page Number on the same page.

New Here ,
Feb 03, 2023 Feb 03, 2023

Copy link to clipboard

Copied

My InDesign Document is broken up into different sections and the pages in each section are numbered per section: Pages in Section A are A.01, A.02, etc. Pages in Section B are B.01, B.02, etc. However, I also want to provide an Absolute Page Number on the bottom right of each page that shows its location in the full document (pg. 02, pg. 03, pg. 04, etc.)

 

How can I add these absolute page numbers so I don't have to do so individually for each page in the file?

TOPICS
EPUB , Feature request , How to , Type

Views

166
Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 03, 2023 Feb 03, 2023

Copy link to clipboard

Copied

One method would be to add a text frame to the Parent/Master pages with a space in it and define the paragraph as a numbered list.

Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 03, 2023 Feb 03, 2023

Copy link to clipboard

Copied

You can't do that in InDesign: references to page numbers, using cross-references or variables, are always to folios (or displayed page numbers). But it's fairly easy to set up for a script.

 

First, add a text frame for the abslute page numbers to the master pages and name it 'abs page num' on the Layers panel:

 

PeterKahrel_0-1675452581103.png

 

 Then run this script:

(function () {
  
  var pp;
  var frame;

  function overrideAbsoluteFrame (page) {
    var f = page.textFrames.item ('abs page num');
    if (!f.isValid) {
      var m = page.masterPageItems;
      for (var i = 0; i < m.length; i++) {
        if (m[i].name === 'abs page num') {
          f = m[i].override (page);
        }
      }
    }
    return f;
  }


  function pad (n) {
    if (n < 10) {
      return '0'+n;
    }
    return String(n);
  }


  pp = app.documents[0].pages.everyItem().getElements();
  for (var i = 0; i < pp.length; i++) {
    frame = overrideAbsoluteFrame (pp[i]);
    frame.contents = pad (pp[i].documentOffset+1);
  }

}());

 

If pages are added or deleted, simply run the script again.

 

P.

Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 03, 2023 Feb 03, 2023

Copy link to clipboard

Copied

Peter S beat me to it! However, shouldn't those frames be threaded for the numbers to display correctly?

Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 03, 2023 Feb 03, 2023

Copy link to clipboard

Copied

LATEST

Yes, the frames do need to be threaded, and no, I don't think you can do a padded number, as such, but you can create pretty much any other sort of prefix as fart of the list definition.

Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines