Article View: adobe.scripting.indesign
Article #16031Re: Q: ID2.02 Page Margin value (VB)
From: Olav_Kvern
Date: Wed, 22 Oct 2003 20:01
Date: Wed, 22 Oct 2003 20:01
46 lines
3074 bytes
3074 bytes
Paul--
Sorry, I only saw that error and didn't pay enough attention to the remainder of the script.
The trouble is that InDesign generates an error when you try to make the page size is smaller than the margin preferences--this is also true from the user interface. But there is no way to set the margin preferences for all pages in a document at once--you would have to iterate through all of the pages, setting each margin to 0. If you're creating a new document, however, you can set the application's default margin preferences before you make the document:
Set myInDesign = CreateObject("InDesign.Application.2.0")
Rem Get the current application default margin preferences.
myOldMarginLeft = myInDesign.MarginPreferences.MarginLeft
myOldMarginRight = myInDesign.MarginPreferences.MarginRight
myOldMarginTop = myInDesign.MarginPreferences.MarginTop
myOldMarginBottom = myInDesign.MarginPreferences.MarginBottom
Rem Set the application default margin preferences to 0
myInDesign.MarginPreferences.MarginLeft = 0
myInDesign.MarginPreferences.MarginRight = 0
myInDesign.MarginPreferences.MarginTop = 0
myInDesign.MarginPreferences.MarginBottom = 0
Rem Create a new document
Set myDocument = myInDesign.Documents.Add
Rem Get the current measurement units
myOldXUnits = myDocument.ViewPreferences.HorzMeasurementUnits
myOldYUnits = myDocument.ViewPreferences.VertMeasurementUnits
Rem Set the measurement units to centimeters
myDocument.ViewPreferences.HorzMeasurementUnits = idMSCentimeters
myDocument.ViewPreferences.VertMeasurementUnits = idMSCentimeters
Rem Set the page size
myDocument.DocumentPreferences.PageWidth = 2
myDocument.DocumentPreferences.PageHeight = 2
Rem restore the measurement units to whatever they were before.
myDocument.ViewPreferences.HorzMeasurementUnits = myOldXUnits
myDocument.ViewPreferences.VertMeasurementUnits = myOldYUnits
Rem now restore the application default margin preferences to whatever they were before.
myInDesign.MarginPreferences.MarginLeft = myOldMarginLeft
myInDesign.MarginPreferences.MarginRight = myOldMarginRight
myInDesign.MarginPreferences.MarginTop = myOldMarginTop
myInDesign.MarginPreferences.MarginBottom = myOldMarginBottom
If you have to use an existing document, you'll still have to set the margin preferences for all of the document pages before you change the page size.
Hope this helps!
Thanks,
Ole
Technical Details
Message-ID:
<2ccdec1d.2@webx.la2eafNXanI>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!fu-berlin.de!newsfeed01.sul.t-online.de!t-online.de!webxReferences:
<2ccdec1d.-1@webx.la2eafNXanI>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f939a,78496c54819935e8 X-Google-Attributes: gidf939a,public X-Google-ArrivalTime: 2003-10-22 13:08:04 PST From: Olav_Kvern@adobeforums.com Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!fu-berlin.de!newsfeed01.sul.t-online.de!t-online.de!webx Newsgroups: adobe.scripting.indesign Subject: Re: Q: ID2.02 Page Margin value (VB) Message-ID: <2ccdec1d.2@webx.la2eafNXanI> Date: Wed, 22 Oct 2003 13:01:58 -0700 References: <2ccdec1d.-1@webx.la2eafNXanI> Lines: 53 MIME-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 8bit