This content has been marked as final.
Show 2 replies
-
1. Re: Adjust margins to an equation based on document size
Jump_Over Aug 3, 2014 4:12 PM (in response to sighmoan)Hi,
Setting a margins directly to some value or to variable is the same. Exam this:
var mH = "180 mm", mW = "250 mm", mDoc = app.activeDocument, mMargin = ( parseInt(mH) + parseInt(mW) ) / 40 + " mm"; with (mDoc.documentPreferences) { pageHeight = mH; pageWidth = mW; } with (mDoc.pages[0].marginPreferences) { top = mMargin; right = mMargin; bottom = mMargin; left = mMargin; }The problem could be if document exists already. In this case setting document.marginPreferences doesn't effect for pages inside a doc.
(since each page is created already and can have its own margins)
You have to set specific page.marginPreferences (or applied master page).
Jarek
-
2. Re: Adjust margins to an equation based on document size
sighmoan Aug 3, 2014 5:00 PM (in response to Jump_Over)Thanks Jarek, that's certainly helped to wrap my head around the treatment of the variables. Now for the fun part of trying to work this as a UI when creating a new document!
I definitely understand about the problem with an already existing document as the marginPreferences only deal with single pages. Setting this up to create a new document from the get-go is the way to go!
S

