Copy link to clipboard
Copied
I've been searching the answer of this simple question but looking no way around.
I have an InDesign document with different page size e.g. left page width is 621 pt. and on the same document right page width is 837 pt.
Now I need to get the width of pages using script but app.documentPreferences.pageWidth return standard document preset size(621 pt.) not the custom page size.
Does any one have the Idea to get custom page size using script.
Thanks in advance
Mac
Mac,
as documentation is showing there are some new properties of "page" since InDesign CS5.
Among those is:
bounds Array of Measurement Unit (Number or String) readonly The bounds of the Page, in the format [y1, x1, y2, x2].
So:
myPage.bounds
and pageWidth of the documentPreferences might be:
myPage.bounds[3]-myPage.bounds[1]
unless myPage is transformed (e.g. rotated and/or sheared and/or scaled) with:
myPage.transform()
...
void transform (in: CoordinateSpaces, from: varies, withMatrix: varies[,
Copy link to clipboard
Copied
Mac,
as documentation is showing there are some new properties of "page" since InDesign CS5.
Among those is:
bounds Array of Measurement Unit (Number or String) readonly The bounds of the Page, in the format [y1, x1, y2, x2].
So:
myPage.bounds
and pageWidth of the documentPreferences might be:
myPage.bounds[3]-myPage.bounds[1]
unless myPage is transformed (e.g. rotated and/or sheared and/or scaled) with:
myPage.transform()
void transform (in: CoordinateSpaces, from: varies, withMatrix: varies[, replacingCurrent: varies][, consideringRulerUnits: bool=false])
Transform the page item.
var d = app.activeDocument;
var myPage = d.pages[0];
var oldPB = myPage.bounds;
var rAngle = -45;
var sAngle = 40;
var myTransformationMatrix1 = app.transformationMatrices.add({counterclockwiseRotationAngle:rAngle});
myPage.transform(CoordinateSpaces.INNER_COORDINATES, AnchorPoint.CENTER_ANCHOR, myTransformationMatrix1);
var myTransformationMatrix2 = app.transformationMatrices.add({clockwiseShearAngle:sAngle});
myPage.transform(CoordinateSpaces.INNER_COORDINATES, AnchorPoint.CENTER_ANCHOR, myTransformationMatrix2);
var newPB = myPage.bounds;
$.writeln(oldPB);
$.writeln(newPB);
Now oldPB and newPB will differ a lot.
So, the question remains: what is a reliable way to show if the myPage was or was not transformed against documentPreferences.pageWidth or if myPage is of rectangular shape at all. See the possibility of adding a sheer angle to the transformation matrix. Also see screen shot:
Transform_Page_CS5.png
Uwe

Copy link to clipboard
Copied
Uwe wrote:
So, the question remains: what is a reliable way to show if the myPage was or was not transformed against documentPreferences.pageWidth or if myPage is of rectangular shape at all. See the possibility of adding a sheer angle to the transformation matrix.
Is this not Page.transformValuesOf()?
Copy link to clipboard
Copied
John,
sure, thank you for pointing this out.
Furthermore I recommend reading "indesigncs3_transform_tutorial_javascript.pdf".
Also as a hint to myself 😉
Uwe
Copy link to clipboard
Copied
Furthermore I recommend reading "indesigncs3_transform_tutorial_javascript.pdf".
In case it wasn't obvious, that's linked from http://www.adobe.com/products/indesign/extend.displayTab2.html#content-dotcom-en-products-indesign-e...
and available at
http://wwwimages.adobe.com/www.adobe.com/content/dam/Adobe/en/products/indesign/pdfs/indesigncs3_tra...
along with some sample scripts at the first URL.
Copy link to clipboard
Copied
Absolutly correct myPage.bounds is what I was looking for.
Many Thanks to Both John and Uwe for great help.
Mac
Find more inspiration, events, and resources on the new Adobe Community
Explore Now