Copy link to clipboard
Copied
Hi,
I cant seem to find this in the documentation. I would like to change the Document Units to mm after I have created it using Javascript. Does anyone know how to do this?
I have figured out how to do this in the app preferences but I would like to do this in the document setup. Changing it in the app preferences isn't displaying it properly in properties panel.
Here's the start of my set up function -
function setUp() {
var newDocument = app.documents.add(DocumentColorSpace.CMYK, 842, 595, 2, DocumentArtboardLayout.GridByCol, 40, 3);
docRef = app.activeDocument;
//HERE I WANT TO ADJUST THE DOCUMENT UNITS TO MM
}
Please see attached screenshot to see the units I am trying to change in the UI.
Any help would be appreciated.
2 Correct answers
Try the following
var docPreset = new DocumentPreset;
docPreset.width = 842;
docPreset.height = 595;
docPreset.units = RulerUnits.Millimeters;
docPreset.artboardLayout = DocumentArtboardLayout.GridByCol;
docPreset.numArtboards = 2
var newDocument = app.documents.addDocument(DocumentColorSpace.CMYK, docPreset);
-Manan
See Charu's suggestion below:
Explore related tutorials & articles
Copy link to clipboard
Copied
Try the following
var docPreset = new DocumentPreset;
docPreset.width = 842;
docPreset.height = 595;
docPreset.units = RulerUnits.Millimeters;
docPreset.artboardLayout = DocumentArtboardLayout.GridByCol;
docPreset.numArtboards = 2
var newDocument = app.documents.addDocument(DocumentColorSpace.CMYK, docPreset);
-Manan
Copy link to clipboard
Copied
Unfortunately they don't just let us change them with script after creation, it has to be done at the moment of creation as Manan describes - but you can't change it afterwards with javascript. You could potentially use either AppleScript or VBS to activate some menus and send some keys to change the units after creation if that is really a burning need.
Copy link to clipboard
Copied
See Charu's suggestion below:

