Skip to main content
Inspiring
February 16, 2023
해결됨

Is it possible to change the page size of a page in inDesign using extend script?

  • February 16, 2023
  • 1 답변
  • 1898 조회

I'm trying to change the dimensions of the second page in my indesign document so it's a custom size, but not having any luck. Is it even possible. What would be the method?

이 주제는 답변이 닫혔습니다.
최고의 답변: rob day

Hi @davidn5918184 , Look at the page resize() method:

https://www.indesignjs.de/extendscriptAPI/indesign-latest/#Page.html#d1e203601__d1e205188

 

 

var p = app.activeDocument.pages[1],
w = 400,
h = 700;

//the resize method expects points unless you set the 6th parameter to true, which uses ruler units
p.resize (CoordinateSpaces.INNER_COORDINATES,AnchorPoint.CENTER_ANCHOR,ResizeMethods.REPLACING_CURRENT_DIMENSIONS_WITH,[w,h])

 

1 답변

rob day
Community Expert
rob dayCommunity Expert답변
Community Expert
February 16, 2023

Hi @davidn5918184 , Look at the page resize() method:

https://www.indesignjs.de/extendscriptAPI/indesign-latest/#Page.html#d1e203601__d1e205188

 

 

var p = app.activeDocument.pages[1],
w = 400,
h = 700;

//the resize method expects points unless you set the 6th parameter to true, which uses ruler units
p.resize (CoordinateSpaces.INNER_COORDINATES,AnchorPoint.CENTER_ANCHOR,ResizeMethods.REPLACING_CURRENT_DIMENSIONS_WITH,[w,h])

 

davidn5918184작성자
Inspiring
February 16, 2023

Awesome, thank you!

 

var secondPage = app.activeDocument.pages[1];
var newWidth = 1080;
var newHeight = 1920;

// Resize the second page
secondPage.resize(CoordinateSpaces.INNER_COORDINATES, AnchorPoint.CENTER_ANCHOR, ResizeMethods.REPLACING_CURRENT_DIMENSIONS_WITH, [newWidth, newHeight], true);