Copy link to clipboard
Copied
Hi,
I'm wondering, how can I change second page size in 3-page spread with ExtendScript?
(I'm trying to generate cover with spine)
app.activeWindow.activeSpread.pages[1].resize(CoordinateSpaces.innerCoordinates, AnchorPoint.centerAnchor, ResizeMethods.ADDING_CURRENT_DIMENSIONS_TO, [-1000, 0])
Copy link to clipboard
Copied
oh, come on! nobody knows how to do this with a script?
Copy link to clipboard
Copied
app.activeWindow.activeSpread.pages[1].resize(CoordinateSpaces.innerCoordinates, AnchorPoint.centerAnchor, ResizeMethods.ADDING_CURRENT_DIMENSIONS_TO, [-1000, 0])
Copy link to clipboard
Copied
any ideas how to set size in mm instead of pixels?
and set exact size for "page" (spine), instead of counting from left page? for example spine should be 5 mm width and 303 mm tall
Copy link to clipboard
Copied
found it here!
function setWidthHeight(/*PageItem*/o, /*str*/w, /*str*/h, /*bool=false*/useVisibleBounds)
{
if( !o.resize ) return;
var CS_INNER = CoordinateSpaces.INNER_COORDINATES,
BB = BoundingBoxLimits[(useVisibleBounds?'OUTER_STROKE':'GEOMETRIC_PATH') + '_BOUNDS'];
var wPt = UnitValue(w).as('pt'),
hPt = UnitValue(h).as('pt');
if( 0 >= wPt || 0 >= hPt ) return;
o.resize(
[CS_INNER,BB],
AnchorPoint.CENTER_ANCHOR,
ResizeMethods.REPLACING_CURRENT_DIMENSIONS_WITH,
[wPt,hPt,CS_INNER]
);
}
// Sample code
// ---
setWidthHeight(app.selection[0], "5cm", "50pt");
Copy link to clipboard
Copied
Resize works in points, not pixels.
To convert between units use UnitValue
The resize method: Page
UnitValue: http://www.indesignjs.de/extendscriptAPI/indesign10/#UnitValue.html
More info on resizing: Scripting InDesign: Transformations
Best info on transformations (thus also resizing) so far: http://www.indiscripts.com/post/2014/03/coordinate-spaces-and-transformations-1
Find more inspiration, events, and resources on the new Adobe Community
Explore Now