0

I have a document in InDesign with a spread of pages with different width-dimensions. Now i want to add vertical guidelines with a JS-Script. Therefore i have to add pageWidth + pageWidth (of a specific page).

But i only know how to get the document dimensions (pageHeight and pageWidth. But i have different pages, and obviously different dimensions.

var pageWidth = app.activeDocument.documentPreferences.pageWidth

will give me the document page width

but i need something like this (fiction)

var pageWidth = app.activeDocument.pages[0].documentPreferences.pageWidth

Thanks for your help

1 Answers1

2
main();

function main() {
    var doc = app.activeDocument;
    var page = doc.pages[0];
    var bounds = page.bounds;
    var width = RoundWithDecimal(bounds[3] - bounds[1], 3);
    var height = RoundWithDecimal(bounds[2] - bounds[0], 3);
}

function RoundWithDecimal(number, decimals){
    var multiplier = Math.pow(10,decimals);
    return Math.round(number*multiplier)/multiplier;
}

Found the answer:

  • Is it possible to also get the dimension of the deviations made from the x and y axis ? If for example in my document I made a difference of 10px on each side, is it possible to recover them? – Fitspade Sep 23 '21 at 13:53