🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: adobe.scripting.indesign
Article #16020

Q: ID2.02 Page Margin value (VB)

#16020
From: Paul_van_Tuel
Date: Tue, 21 Oct 2003 02:38
61 lines
2709 bytes
Hi there,
I need to set the page margin in InDesign to 0 (Zero). I had this working in InDesign 1.0, but since then (v1.52+, 2.0+) the code I have doesn't work anymore. We are running InDesign inside a VB app. A button click asks for the job size (using a VB form) and creates the new advert.

Can anyone see a fatal flaw in this code? I have removed any unecessary code, so appologies if I have removed too much code.

My code at present is as follows (VB6 Code):
---
' Create a totally new job
sizeX = "20 cm" 'hard coded for this example code
sizeY = "20 cm" 'hard coded for this example code
If FileExists(App.path & "\Templates\master.indt") Then
  Set InAdvert = InDesign.Documents.Open(App.path "\Templates\master.indt")
Else
  Set InAdvert = InDesign.Documents.Add
End If

Set InWindow = InDesign.ActiveWindow
Set InSpread = InWindow.ActiveSpread

Set InViewPrefs = InAdvert.ViewPreferences
With InViewPrefs
  .HorzMeasurementUnits = idMSPoints
  .VertMeasurementUnits = idMSPoints
  .ShowMasterItems = False
  .RulerOrigin = idPageOrigin
End With
If InViewPrefs.ShowRulers = False Then
  InViewPrefs.ShowRulers = True
End If

Set InDocPrefs = InAdvert.DocumentPreferences
With InDocPrefs
  .NumberOfPages = 1
  .PagesPerSpread = 1
  .MarginGuideColor = idUIBlue
End With

'Remove the margins
Set InAdPage = InAdvert.Pages(1)
Set InMargPrefs = InAdPage.MarginPreferences
With InMargPrefs
  'I have tried using "0cm", "0 cm" too, but the margins stay at the
  'default size.
  .ColumnGutter = "0"
  .MarginBottom = "0"
  .MarginTop = "0"
  .MarginLeft = "0"
  .MarginRight = "0"
End With

On Error GoTo JobSizeIssue
'this is where things go wrong. If we want to set the job size to 2cmx2cm
'(a small advertisement) then the size of the ad is less than the margin
'size. As you can see, I set the margin size to 0 above, but this seems to
'have no effect.
InDocPrefs.PageWidth = sizeX
InDocPrefs.PageHeight = sizeY
On Error GoTo 0
---

email: paulvt@alliedpress.co.nz
Technical Details
Message-ID: <2ccdec1d.-1@webx.la2eafNXanI>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!uio.no!news.tele.dk!news.tele.dk!small.news.tele.dk!newsfeed.arcor-online.net!newsfeed01.sul.t-online.de!t-online.de!webx

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f939a,78496c54819935e8,start
X-Google-Attributes: gidf939a,public
X-Google-ArrivalTime: 2003-10-20 20:07:41 PST
From: Paul_van_Tuel@adobeforums.com
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!uio.no!news.tele.dk!news.tele.dk!small.news.tele.dk!newsfeed.arcor-online.net!newsfeed01.sul.t-online.de!t-online.de!webx
Newsgroups: adobe.scripting.indesign
Subject: Q: ID2.02 Page Margin value (VB)
Message-ID: <2ccdec1d.-1@webx.la2eafNXanI>
Date: Mon, 20 Oct 2003 19:38:23 -0700
Lines: 69
MIME-Version: 1.0
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit