Copy link to clipboard
Copied
Hi,
I am unable to resize page document size in Indesign CS6 js smaller than 1 inch. I set the Margin to 0, but unable to set Gutter to 0. Maybe that is the reason:
masters = myDoc.masterSpreads.item('A-Master').pages;
for (i = 0; i < masters.length; i++) {
masters.marginPreferences.properties = {
top: 0,
left: 0,
right: 0,
bottom: 0
}}
myPageCount = "1";
myPageCount = eval (myPageCount);
with(myDoc.documentPreferences){
pagesPerDocument = 2;
}
myDoc.spreads[0].remove();
with(myDoc.documentPreferences){
pagesPerDocument = myPageCount;
}
while ( pg = pgs.pop() ) {
app.marginPreferences.properties = {
top:0, left:0, bottom:0, right:0,
columnGutter:0, columnCount:1
};
}
Thank you
Yulia
Copy link to clipboard
Copied
Hi Yuliascript,
Try this:
app.documents[0].viewPreferences.horizontalMeasurementUnits = MeasurementUnits.INCHES;
app.documents[0].viewPreferences.verticalMeasurementUnits = MeasurementUnits.INCHES;
app.documents[0].documentPreferences.pageWidth = app.documents[0].documentPreferences.pageWidth - 1;
app.documents[0].documentPreferences.pageHeight = app.documents[0].documentPreferences.pageHeight - 1;
app.documents[0].pages[0].marginPreferences.columnGutter = 0;
app.documents[0].pages[0].marginPreferences.left = 0;
app.documents[0].pages[0].marginPreferences.right = 0;
app.documents[0].pages[0].marginPreferences.top = 0;
app.documents[0].pages[0].marginPreferences.bottom = 0;
Best
Sunil
Copy link to clipboard
Copied
Thank you, Sunil.
It looks now that there is more to the story, because with your code I get 0 Margin and 0 Gutter, but small sizes still fail to resize.
I have few sizes in the script set up in the same way, when one is bigger than I inch by 1 inch it works, but when when one is smaller it fails at resizing line.
If this helps, here is my code:
myWidth = 0.625; // art size
myHeight = .25;
with(myDoc.documentPreferences){
pageHeight = myHeight;
pageWidth = myWidth;
}
Thank you
Yulia
Copy link to clipboard
Copied
Perhaps by setting the margin preferences for the application before creating the document can do it for you. This works in InDesign CC 2019. (Notice that application preferences are saved and later restored.)
app.scriptPreferences.measurementUnit = MeasurementUnits.INCHES;
var oldPrefs = app.marginPreferences.properties;
app.marginPreferences.properties = {left:0, right:0, top:0, bottom:0};
var docRef = app.documents.add();
docRef.documentPreferences.pageWidth = .65;
docRef.documentPreferences.pageHeight = .25;
app.marginPreferences.properties = oldPrefs;
Copy link to clipboard
Copied
https://forums.adobe.com/people/S+Hopkins wrote
Perhaps by setting the margin preferences for the application before creating the document can do it for you. …
Absolutely!
That's the key here.
Regards,
Uwe
Get ready! An upgraded Adobe Community experience is coming in January.
Learn more