Update (2-Oct-2021). — Version 1.28 of PageBorder fixes a UI problem in InDesign CC (the option for removing the border once created was hidden.) Tip: if you need to customize the color of the border (defaulted to Black), simply replace the name assigned to the strokeColor property, Line 26 of the script.


Need to have a page border on your job up until it goes to the printer? PageBorder quickly creates a temporary customizable black border around the active page, or every page, of your InDesign document. The script is compatible with ID CS3, CS4, and even CS5 which allows multiple page sizes per document.

A few years ago, Cari Jansen wrote the useful 1pt Stroke All Pages script for InDesign CS and CS2. Cari's code creates a rectangle on each page, set to exact page size, with fill None and stroke 1pt Black. The object is placed in a separate layer, so that it can easily be removed/disabled by the user. That's exactly what PageBorder does, except that it provides a user interface with some extra features and supports InDesign CS3-CS5.

The most important change is that we now need to support multiple page sizes per document —through the Page.bounds property. This involves resetting the rectangle size within the page loop, as shown in the below snippet:

var createBorder = function(/*Layer*/layer)
//------------------------------------------------
// this: Page [collective allowed]
{
    var pages = this.getElements(),
        alignMode = StrokeAlignment[alignStrings[align].
            toLowerCase()+'Alignment'],
        pg;
 
    var recProps = {
        fillColor: 'None',
        strokeColor: 'Black',
        strokeTint: 100,
        strokeWeight: ptBorder,
        strokeAlignment: alignMode,
        strokeType: (jDots && jDotsStyleName) || solidStyleName,
        };
 
    while( pg=pages.pop() )
        {
        recProps.geometricBounds = pg.bounds;
        pg.rectangles.add(layer,undefined,undefined,recProps);
        }
};
 

So InDesign CS5 users can apply PageBorder on this kind of spread:

Support for multiple page sizes.

PageBorder Dialog and Settings

PageBorder displays a simple dialog to let you manage a few settings. (Note that these settings are session-persistent, so the script always starts from the last configuration.)

PageBorder dialog box (Windows screenshot).

• The Weight field allows you to set the stroke weight of the page border, from 0.1 to 5 pts. You can explicitly enter any unit, e.g. "0.3 mm". The default unit is point (pt) for CS3/CS4 users. In InDesign CS5, the default unit is the one defined in Edit > Preferences >Units & Increments > Other Units > Stroke.

• The Alignment listbox lets you choose how to align stroke over page boundaries: Inside, Outside, or Center.

• Check All Pages to apply PageBorder over the whole document. Otherwise, only the active page is processed.

• Check Dotted Stroke to get a dotted border using the “Japanese Dots” stroke type.

• The script always creates the border in a dedicated layer called PageBorderLayer, which is automatically locked. You don't need to handle or remove this layer by yourself, because the script manages it:
— To update the border(s) at any time, rerun PageBorder, adjust the settings, and press OK.
— To finally remove the border(s) when your document goes to print, run PageBorder, check Remove the border, and press OK.

• See also:
Review and Demo of PageBorder in French (Urbanbike).
Review on Cari Jansen's blog.
Review on DesignGu.ru (in Russian).
— The script is mentioned on InDesignSecrets: “This Week in InDesign Articles, Number 41”.

• Special thanks and credits to: Jean-Christophe Courte, Stéphane Georis, David Blatner, and of course Cari Jansen for the original idea.