fabianmoronzirfas
4/27/2016 - 11:17 AM

margins.js

// shows how to apply margins to the master spreads
// all newly create pages will use these settings for their margins
//
// if we have facingPages the left becomes the inner margin
// the right becomes the outer margin
//
// switch between
// facingPages true/false
// to see the difference
var doc = app.documents.add({
  documentPreferences: {
    pageHeight: 300,
    pageWidth: 200,
    facingPages: false
  }
});
var master_spread1 = doc.masterSpreads.item(0).pages.item(0); // edit the master spreads
master_spread1.marginPreferences.properties = {
  top: 20,
  left: 100,
  right: 30,
  bottom: 20
};
if (doc.masterSpreads.item(0).pages.length > 1) {
  var master_spread2 = doc.masterSpreads.item(0).pages.item(1); //edit the other master spread
  master_spread2.marginPreferences.properties = {
    top: 20,
    left: 100,
    right: 30,
    bottom: 20
  };
}
doc.pages.add();
doc.pages.add();