Skip to main content
April 28, 2015
Question

text autoflow

  • April 28, 2015
  • 1 reply
  • 296 views

I have a document page 1 have overflow text, if I need to flow all text content, it should need 10 pages to flow, I try to use the script to flow all text content in a new page , but can;t autoflow, only add 1 page, how can I autoflow the remain content?

var myDoc = app.activeDocument;

var myFrames = myDoc.textFrames;

while (myFrames[0].overflows === true) {

    var myNewPage = myDoc.pages.add();

    var myMargin = myNewPage.marginPreferences;

    var myBounds = [myMargin.top, myMargin.left, myDoc.documentPreferences.pageHeight - myMargin.bottom, myDoc.documentPreferences.pageWidth - myMargin.right];

    var myOldRuler = myDoc.viewPreferences.rulerOrigin;

    myDoc.viewPreferences.rulerOrigin = RulerOrigin.pageOrigin;

    with(myDoc.pages[-1].textFrames.add()) {

        geometricBounds = myBounds;

        previousTextFrame = myDoc.pages[-2].textFrames[0];

        }

    myDoc.viewPreferences.rulerOrigin = myOldRuler;

    }

This topic has been closed for replies.

1 reply

TᴀW
Legend
April 28, 2015

I wrote a routine to do this a while back:

http://www.id-extras.com/multi-file-auto-place

Take a look at the while loop there -- it continues adding pages and

frames until there is no more overflow.

There is no way to autoflow automatically with a script like there is by

shift-clicking in the UI. Unless you switch on Smart Text Reflow and get

that to kick in, I suppose.

id-extras.com | InDesign tools & scripts for typesetters, form designers, and translators