Article View: adobe.scripting.indesign
Article #1593Re: Detecting Permanent Overset
From: Dave_Saunders
Date: Sun, 01 Feb 2009 15:48
Date: Sun, 01 Feb 2009 15:48
42 lines
2724 bytes
2724 bytes
Here's the function:
function runPages(theDoc, theStory) {
var uRuler = theDoc.viewPreferences.rulerOrigin;
theDoc.viewPreferences.rulerOrigin = RulerOrigin.spreadOrigin;
while (theStory.textContainers[theStory.textContainers.length-1].overflows) {
theDoc.documentPreferences.pagesPerDocument = theDoc.documentPreferences.pagesPerDocument + 1;
var backPage = theDoc.pages[-1];
app.activeWindow.activePage = backPage;
backPage.appliedMaster = theDoc.pages[-2].appliedMaster;
var myPbounds = backPage.bounds;
var myNewTF = backPage.textFrames.add();
if ((backPage.name % 2 == 1) || (!theDoc.documentPreferences.facingPages)) {
myNewTF.geometricBounds =
[myPbounds[0] + backPage.marginPreferences.top,
myPbounds[1] + backPage.marginPreferences.left,
myPbounds[2] - backPage.marginPreferences.bottom,
myPbounds[3] - backPage.marginPreferences.right];
} else {
myNewTF.geometricBounds =
[myPbounds[0] + backPage.marginPreferences.top,
myPbounds[1] + backPage.marginPreferences.right,
myPbounds[2] - backPage.marginPreferences.bottom,
myPbounds[3] - backPage.marginPreferences.left];
}
myNewTF.itemLayer = theStory.textContainers[theStory.textContainers.length-1].itemLayer;
myNewTF.previousTextFrame = theStory.textContainers[theStory.textContainers.length-1];
myNewTF.textFramePreferences.textColumnCount = backPage.marginPreferences.columnCount;
myNewTF.textFramePreferences.textColumnGutter = backPage.marginPreferences.columnGutter;
if (myNewTF.characters.length == 0){
theDoc.viewPreferences.rulerOrigin = uRuler;
throw ("Permanently overset"); // This indicates a permanent overset condition so break out of loop
}
}
theDoc.viewPreferences.rulerOrigin = uRuler;
}
And indeed, it throws the error if you try to use it to run pages for a story that consists (or includes) a table long enough that one frame in the originally overset material consists only of a part of the table.
Grrr.
Dave
Technical Details
Message-ID:
<59b7bfd9.0@webcrossing.la2eafNXanI>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!newshub.sdsu.edu!webcrossingReferences:
<59b7bfd9.-1@webcrossing.la2eafNXanI>Show Full Headers
Complete Article Headers
X-Google-Thread: f939a,eed2f709e19dc3b7 X-Google-Attributes: gidf939a,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit From: Dave_Saunders@adobeforums.com Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!newshub.sdsu.edu!webcrossing Newsgroups: adobe.scripting.indesign Subject: Re: Detecting Permanent Overset Message-ID: <59b7bfd9.0@webcrossing.la2eafNXanI> Date: Sun, 1 Feb 2009 07:48:56 -0800 References: <59b7bfd9.-1@webcrossing.la2eafNXanI> Lines: 60 MIME-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 8bit