3 Replies Latest reply on Jan 21, 2017 9:14 AM by Peter Kahrel

    InDesign — set the margins of the opened document




      I've searched on the forums and on Google but I can't find the solution to my problem.


      I would like to create a (java) script that set margins according to the opened InDesign file and not create a new one.


      Here is a sample code (doesn't work as I would like to):


          var doc = app.documents.add({


          var page = doc.pages.item(0);

          page.marginPreferences.properties = {

              top : 30,

              left: 30,

              right: 30,





      – This create a new document (using the default format) but I'd like the script to run on the opened file in InDesign.

      How can I do this?


      – I also would like to set the margins by using the size of the page. Here is an example: top margin = (width-height)/12

      How could I achieve this?



      Thanks a lot for the help.



      Ps: sorry for my English and my low level in JS.