Article View: adobe.scripting.indesign
Article #14558Help, Images in rectangles and lines.
From: Roel_G
Date: Thu, 22 Jan 2004 10:04
Date: Thu, 22 Jan 2004 10:04
106 lines
3943 bytes
3943 bytes
Hi,
I wrote a function that gets a parameter "pagina" (witch is page) and then print on the passed page 2 figures and one line above the figures.
my document has 7 pages. one front page and 6 double pages. So the numbers would be like this.
1
23
45
67
If I call my function wich is called footer to print on page 1 there is no problem. If I call it to print on page 2, 4 or 6 there is also no problem. But if I call my function to print on page 3 then it prints on page 2. And a call to page 5 will print on 4. So a call to page 7 will print on guess what... indeed page 6.
a call goes like this
call Footer(3)
wich will print on 2.
lets take a look at the function itself.
'get the parameter pagina as an integer
Private Sub Footer(pagina As Integer)
'the declaration of my variables
Dim myIndesign As InDesign.Application
Dim myDocument As InDesign.Document
Dim myPage As InDesign.Page
Dim myText As InDesign.TextFrame
Dim myImg As InDesign.Rectangle
Dim myline As InDesign.Line
'create the indesign object.
Set myIndesign = CreateObject("Indesign.Application.2.0")
'get the active document
Set myDocument = myIndesign.ActiveDocument
'the colors are defined in the main function.
'There is only one witch is name is AA
Dim myColors As InDesign.Colors
Set myColors = myDocument.Colors
'set the viewpreferences.rulerorigin to Page origin so I can
'normaly orient per page and not per spread.
myDocument.ViewPreferences.RulerOrigin = idPageOrigin
'Sets the active page to the page we provided by the function
'for example if we called Footer(3) it will be page 3 I guess?
Set myPage = myDocument.Pages.Item(pagina)
'Get the size of the page.
pWidth = myDocument.DocumentPreferences.PageWidth
pHeight = myDocument.DocumentPreferences.PageHeight
'get the left margin
mleft = myPage.MarginPreferences.MarginLeft
'get the buttom margin
mbottom = pHeight - myPage.MarginPreferences.MarginBottom
'it must be 20 picas width
mright = mleft + 20
'and 4 picas high
mtop = mbottom - 4
'create a rectangle
Set myImg = myPage.Rectangles.Add
'set the size and position
myImg.GeometricBounds = Array(mtop, mleft, mbottom, mright)
'get the file name
myFile = App.Path & "\LOGO\" & "AAG.tif"
'place the image
myImg.Place myFile
'fit the immage in the rectangle
myImg.Fit idProportionally
myImg.Fit idCenterContent
'get new coordinates for next immage
mright = pWidth - myPage.MarginPreferences.MarginRight
mleft = mright - 10
mbottom = pHeight - myPage.MarginPreferences.MarginBottom
mtop = mbottom - 4
'create new rectangle and place the other immage
Set myImg = myPage.Rectangles.Add
myImg.GeometricBounds = Array(mtop, mleft, mbottom, mright)
myFile = App.Path & "\LOGO\" & "AA.tif"
myImg.Place myFile
myImg.Fit idProportionally
myImg.Fit idCenterContent
'coordinates for the line
mright = pWidth - myPage.MarginPreferences.MarginRight
mleft = myPage.MarginPreferences.MarginLeft
mbottom = pHeight - myPage.MarginPreferences.MarginBottom - 4
mtop = mbottom
'add the line
Set myline = myPage.Lines.Add
'set the coordinates
myline.GeometricBounds = Array(mtop, mleft, mbottom, mright)
'set the color
myline.StrokeColor = myColors.Item("AA")
'and set the how thick the line is.
myline.StrokeWeight = 2
End Sub
What did I do wrong here?
MVG
Roel G
Technical Details
Message-ID:
<2ccf8213.-1@webx.la2eafNXanI>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!fu-berlin.de!newsfeed01.sul.t-online.de!t-online.de!webxShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f939a,7a98ef87fd93c4c7,start X-Google-Attributes: gidf939a,public X-Google-ArrivalTime: 2004-01-22 02:07:38 PST From: Roel_G@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: Help, Images in rectangles and lines. Message-ID: <2ccf8213.-1@webx.la2eafNXanI> Date: Thu, 22 Jan 2004 02:04:42 -0800 Lines: 112 MIME-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 8bit