This content has been marked as final.
Show 3 replies
-
1. Re: [JS][CS4] Minimum document size in javascript?
Marc Autret Aug 18, 2011 8:26 AM (in response to booyajamo)Hi Lindsay,
In ID CS4 the minimum document page size is 1pt × 1pt. Setting such tiny values through scripting can fail because you have to inhibit the default margin preferences. The problem is that the Document.marginPreferences property does not work during document construction—I think this is a bug. So the following code does not work:
// DOES NOT WORK -- BUG? app.documents.add(true, undefined, { marginPreferences: {top:0, left:0, bottom:0, right:0,columnGutter:0,columnCount:1}, documentPreferences: {pageWidth:'1pt', pageHeight:'1pt'}, });The only solution I know is to temporarily change the application margin preferences:
// Backup the default app margin prefs // --- var bkp = app.marginPreferences.properties; // Change the margin prefs to allow small document size // --- app.marginPreferences.properties = { top:0, left:0, bottom:0, right:0, columnGutter:0, columnCount:1 }; // Create a 'minimal' document var doc = app.documents.add(true, undefined, {documentPreferences: {pageWidth:'1pt', pageHeight:'1pt'}} ); // Restore the default app margin prefs // --- app.marginPreferences.properties = bkp;@+
Marc
-
2. Re: [JS][CS4] Minimum document size in javascript?
booyajamo Aug 18, 2011 12:26 PM (in response to Marc Autret)Hi Marc,
Thank you so much! I figured (and was hoping) there was some way to force the change. Thank you for taking the time to answer!!
Lindsay
-
3. Re: [JS][CS4] Minimum document size in javascript?
milligramme Aug 18, 2011 6:03 PM (in response to Marc Autret)Hi.
Here is another solution, applied margin to also Master Spread.
var doc = app.documents.add(); doc.marginPreferences.properties = {top:0,right:0,bottom:0,left:0}; // this part doesnt work?? // var mst_page = doc.masterSpreads[0].pages.everyItem(); // mst_page.marginPreferences.properties = {top:0,right:0,bottom:0,left:0}; var mst_page_1 = doc.masterSpreads[0].pages[0]; mst_page_1.marginPreferences.properties = {top:0,right:0,bottom:0,left:0}; var mst_page_2 = doc.masterSpreads[0].pages[1]; mst_page_2.marginPreferences.properties = {top:0,right:0,bottom:0,left:0}; doc.documentPreferences.pageWidth = '1pt'; doc.documentPreferences.pageHeight = '1pt';mg



