Reply To: Script to Auto-Adjust Page Length based on content

Home Page / Forums / General InDesign Topics (CLOSED) / Script to Auto-Adjust Page Length based on content / Reply To: Script to Auto-Adjust Page Length based on content

#14406137

Just For Fun! …

https://snipboard.io/3iCQpY.jpg

By Script of course:

/*
_FRIdNGE-0758_ResizePageOnTextFrame.jsx
Script written by FRIdNGE, Michel Allio [04/09/2024]
*/

app.doScript(“main()”, ScriptLanguage.javascript, undefined, UndoModes.ENTIRE_SCRIPT, “Resize Page On Text Frame! …”);

function main() {

app.scriptPreferences.measurementUnit = MeasurementUnits.POINTS;

var myDoc = app.activeDocument;
myDoc.zeroPoint = [0,0];
myDoc.viewPreferences.rulerOrigin = RulerOrigin.PAGE_ORIGIN;

var myPages = myDoc.pages,
P = myPages.length, p;

for ( p = 0; p < P; p++ ) {
var myPage = myPages[p];
myPage.marginPreferences.properties = {top: 0, left: 0, bottom: 0, right: 0};
var myTFrame = myPage.textFrames[0];
myTFrame.move([0,0]);
var myPageWidth = myTFrame.geometricBounds[3]-myTFrame.geometricBounds[1];
var myPageHeight = myTFrame.geometricBounds[2]-myTFrame.geometricBounds[0];
myPage.resize(BoundingBoxLimits.GEOMETRIC_PATH_BOUNDS, AnchorPoint.TOP_LEFT_ANCHOR, ResizeMethods.REPLACING_CURRENT_DIMENSIONS_WITH, [myPageWidth, myPageHeight]);
}

alert( “Done! …\rby FRIdNGE, Michel Allio [04/09/2024]” )

}

(^/) The Jedi

This article was last modified on September 4, 2024

Comments (0)

Loading comments...