Skip to main content
Participant
June 13, 2023
Answered

How to create a line in the footer that looks like grows in InDesign?

  • June 13, 2023
  • 10 replies
  • 2561 views

I am looking to create a line in my footer that looks like the "grows" with each page of the document. So for example the first page it starts at a lenth of 1 and the second page it would be a 2 so on and so forth.

I have been able to create this by manually drawing the line and adjusting it with each page however I was wondering if anyone has ever done this with some level of automation? 

It would be ideal if I had a parent page set up and ID automatically adjusted the size of the line based on the total document length and the current page number. 

 

<Title renamed by moderator>

This topic has been closed for replies.
Correct answer Peter Kahrel

Well, ok, "a line in the footer" doesn't have to be a footnote-separator rule. But that's how I interpreted it.

10 replies

Peter Kahrel
Community Expert
Community Expert
July 6, 2023

I thought I should put my idea to the test. Here's a script, a sample document is attached.

There's one requirement: the footer lines should be named 'Progress line' on the Layers panel:

 

 

A nice enhancement would be to place a lighter-shade bar behind the progress bar so it's easier to see how much there's left to go.

 

(function () {
    
  var indd = app.documents[0];
  var pages = indd.pages.everyItem().getElements();
  var rule;
  var gb;
  var step;


  function stepValue () {
    var r = indd.masterSpreads.everyItem()
            .graphicLines.everyItem().getElements();
    for (var i = 0; i < r.length; i++) {
      if (r[i].name === 'Progress line') {
        var b = r[i].geometricBounds;
        return (b[3] - b[1]) / (indd.pages.length-1);
      }
    }
    return null;
  }

  //--------------------------------------
  // If there's a rule on the page, return it.
  // Otherwise, try to override one.
  
  function getRule (page) {
    var r = page.graphicLines.item ('Progress line');
    if (r.isValid) {
      return r;
    }
    var m = page.masterPageItems;
    for (var i = 0; i < m.length; i++) {
      if (m[i].name === 'Progress line') {
        return m[i].override (page);
      }
    }
    return null;
  }
        
  //==================================================
  
  step = stepValue();

  if (!stepValue) {
    alert ('The document lacks a rule named "Progress line"');
    exit();
  }

  for (var i = 0; i < pages.length; i++) {
    rule = getRule (pages[i]);
    if (rule) {
      gb = rule.geometricBounds;
      rule.geometricBounds = [gb[0], gb[1], gb[2], gb[1]+(i*step)];
    }
  }

}());

 

Community Expert
July 5, 2023

The Chartwell font using the vertical bar feature would need nothing other than applying the current page marker with the font. Note, this feature works from 0 to 100, if you have more than a hundred pages, you would need to tweak it.

Peter Kahrel
Community Expert
Community Expert
July 6, 2023

Clever! Though the page marker is a marker that the font doesn't see as a number. You'd have to use a text frame and use a script to place the page number (or document offset) in there. Also, you need a conversion number: page 50 in a 100-page file and page 5 in a 10-page document should get the same length bar, but won't.

Peter Kahrel
Community Expert
Community Expert
July 5, 2023

Hang on -- I think a paragraph rule would be unnecessarily complicated. Much easier simply to place a line on each master page. Make the line as wide as the text width. Then a script determines by how much the line should grow on each page (or, step value: line length divided by page extent), then overrides the line on each page and sets the line length on the first page to the step value, and adds the step value on each page. Before overriding the line, check whether it's already on the page (from a previous run). That way, if you add or remove pages, simply run the script again.

 

P.

Peter Spier
Community Expert
Community Expert
July 5, 2023

Well, I'm not sure ethat's easier. For your method you need a Parent Page for each width of line. Mine uses onluy a single parent. Rearranging pages could get complicated, but there are some scripts for breaking text threads, for example, that might make it simpler adjust the order of the threaded frames.

Peter Kahrel
Community Expert
Community Expert
July 5, 2023

No, that's not the case. As I wrote, you place a line on a parent page, the script overrides and resizes the line on each document page.

Peter Kahrel
Community Expert
Community Expert
June 15, 2023

I was not thinking about footnotes at all

 

Oh, groan. Of course. The topic's title is "a line in the footer", not "a line in the footnote". How dumb.

 

Right, with that out of the way, I agree that your approach of an empty paragraph with a pres-set paragraph rule, which is manipulated by a script, is a workable solution. From a scripting point of view, it would be easier to set a rule on the master page(s), name it on the Layers panel so that it's easy to find, and a script, after overriding the rule on each page, changes its width. Very simple.

 

Apologies for the for all the confusion caused.

 

P.

Participant
July 5, 2023

Thanks for all the suggestions! I will tinker around with a Paragraph rule on the Parent page and a script. 

Cheers!

Peter Kahrel
Community Expert
Community Expert
June 15, 2023

> One should not presume to question another's reasons for wanting a design element

 

Absolutely. My joking was inappropriate.

 

@cor16940910  -- Please don't be discouraged by our banter.

 

What you're after is prefectly doable with a combination of the suggestions made above by Peter S. and Robert. It works along these lines:

1. In the paragraph style used for the footnotes, set up a paragraph rule: set the width, offset, and colour. And set the right indent to the width of the text frame. (We assume that all text frames are the same width). Disable the paragraph rule in the style.

2. A script then determines how many pages there are with notes,, divides the frame width by the number of pages  with notes (which returns the step value), then on each page it enables the rule in the first footnote on a page and decreases the step value. (You can't set the length of the separator rule directly, you have to manipulate either the left or the right indent values or both to set the rule's length.)

 

One of Peter S.'s stipulations still holds: the any page should start with a complete footnote, that is, you can't have continuation notes. The reason is that a page with just a continuation note doesn't contain any notes from a script's perspective. You can determine whether a page starts with a continued note, but if a page contains just a continued note you can't display the rule on that page.

 

To deal with continuation notes you's have to use a different approach, namely, calculate the footnote area on each page. And as I mentioned earlier, that's not trivial.

 

Anyway, let us know (a) whether you did indeed meant separator rules and (b) whether you're still interested in a working solution.

 

P.

Peter Spier
Community Expert
Community Expert
June 15, 2023

Just to be clear, I was not thinking about footnotes at all, and didn't, from my reading, think they were being used. I simply was using an empty paragraph with an ordinary Paragraph Rule (above or below, as you choose). I started my sequence with the maximum indent and worked towards a full width rule as that was my interpretation of the request.

Peter Kahrel
Community Expert
Community Expert
June 13, 2023

Ten years ago they wanted to resize rectangles, which isn't too difficult. But to place footnote-separation rules with a script it's unbelievably complicated to find the rule's vertical position. Peter S's approach seems the only viable one.

Robert at ID-Tasker
Legend
June 13, 2023

At what point it become about rule separating footnotes?? 

 

Peter Kahrel
Community Expert
Peter KahrelCommunity ExpertCorrect answer
Community Expert
June 13, 2023

Well, ok, "a line in the footer" doesn't have to be a footnote-separator rule. But that's how I interpreted it.

Peter Spier
Community Expert
Community Expert
June 13, 2023

I haven't been able to automate it, but I can build a progressively growing line by creating a series of paragraph styles that loop and have a paragraph rule turned on. For each successive style you decrease the indent amount.

Style 1 uses style 2 as next style, Style 2 uses Style 3 as next, etc. up to the full width rule, and that style uses Style 1 again as next style. Keep options should be set to start in next column.

A threaded pair of empty frames on the Parent page will allow you to override on the first page where you wand the line to appear, then simply keep on pressing the Enter key.

Without some sort of automation I don't think this is viable for a long document.

Robert at ID-Tasker
Legend
June 13, 2023

@Peter Spier you are on to something... 

 

How about file prepared in Excel - like this:

 

#

##

###

####

...

 

where # would be a solid glyph - and then this would be imported and auto flown into a TextFrame in the footer?

 

Peter Spier
Community Expert
Community Expert
June 13, 2023

For the paragraph rule to work you need only the return, no actual printing characters.

Just tried an experiment making a text file in excel that is nothing but a column of cells with a single space character and then saved as tab deleimited text. You need the space to make the text file.

Placed that file into a .indd doc and at first the only style used was the Style 1, but I was able to fix that by simply doing a select all after selecting one paragraph, then right-clicking Style 1 in the Paragraph Styles panel and selecting Apply Style 1 and next style, so I have a blank 70 page file (the number of rows in my text file) with the progressive line. That might be a possible solution for @cor16940910 

Robert at ID-Tasker
Legend
June 13, 2023

I can't think of any automatic - built in - way to do this. 

 

But it's easily scriptable - either by duplicating some object from page to page and make it longer - or override object from MasterSpread and then set its length based on the page's index.

 

I'm not JS guy so can't give you working code. 

 

Peter Spier
Community Expert
Community Expert
June 13, 2023

It would help if you could show us a mock-up of what you have in mind.