Article View: adobe.scripting.indesign
Article #14683[VB]Image on wrong page.
From: Roel_G
Date: Wed, 21 Jan 2004 08:53
Date: Wed, 21 Jan 2004 08:53
62 lines
2894 bytes
2894 bytes
Hello,
I'm totally new to Indesign and scripting for it. But I have some experience with database development and Visual Basic.
So now you have a brief idea of what I can do.
Now I have a small problem. I'm trying to automatically generate pages
with a image on it (path to image comes out of mysql) and a small text underneath it. (text also comes out of mysql.)
I have a few vars declared
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
then I did this stuff
Set myIndesign = CreateObject("Indesign.Application.2.0")
Set myDocument = myIndesign.Documents.Add
myDocument.ViewPreferences.RulerOrigin = idPageOrigin
Then I connect to my database and in a loop I do this
LOOP 'until the EOF
Set myPage = myDocument.Pages.Item(i) 'i == counter in loop
Set myText = myPage.TextFrames.Add
Set myImg = myPage.Rectangles.Add
pWidth = myDocument.DocumentPreferences.PageWidth
pHeight = myDocument.DocumentPreferences.PageHeight
mleft = myPage.MarginPreferences.MarginLeft
mright = 25
mtop = myPage.MarginPreferences.MarginTop
mbottom = 25
myText.GeometricBounds = Array(mtop + mbottom + 3, mleft, mbottom, mright)
myImg.GeometricBounds = Array(mtop, mleft, mbottom, mright)
myFile = rs.Fields("linktopicture")
myImg.Place myFile
myImg.Fit idProportionally
myImg.Fit idCenterContent
artikelcode = rs.Fields("artikelcode")
myText.Contents = artikelcode
myDocument.DocumentPreferences.NumberOfPages = yDocument.DocumentPreferences.NumberOfPages + 1 = i + 1 End loop
Now When i run this code It creates one page with the first picture and text on it. and it is positioned the right way.
Then It creates a new page witch is also right but then it creates a page next to this page (double sided) places the image on the previous page but the text on the good page.
How can I get this image also on the good place.
It does this with all the double sided pages. So every image witch is on the other side of the page is positioned on the prev page. But the text is positioned right.
how come?
best regards
Roel G
PS.
I use Visual Basic 6 and Image ready 2.0
Technical Details
Message-ID:
<2ccf7c40.-1@webx.la2eafNXanI>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.fjserv.net!newsfeed.freenet.de!eusc.inter.net!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,3663529df6bffd0d,start X-Google-Attributes: gidf939a,public X-Google-ArrivalTime: 2004-01-21 01:07:34 PST From: Roel_G@adobeforums.com Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.fjserv.net!newsfeed.freenet.de!eusc.inter.net!newsfeed01.sul.t-online.de!t-online.de!webx Newsgroups: adobe.scripting.indesign Subject: [VB]Image on wrong page. Message-ID: <2ccf7c40.-1@webx.la2eafNXanI> Date: Wed, 21 Jan 2004 00:53:29 -0800 Lines: 73 MIME-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 8bit