Skip navigation
Sashikala Balasubramanian
Currently Being Moderated

working with artboards

Nov 23, 2011 11:20 PM

I need to place one image in each artboard.

 

illus_app.ActiveDocument.Artboards.SetActiveArtboardIndex(1)

thisPlacedItem = illus_app.ActiveDocument.PlacedItems().Add

thisPlacedItem.File = "D:\test1.eps"

thisPlacedItem.Top = myDocument.height / 2 + thisPlacedItem.Height / 2

thisPlacedItem.Left = myDocument.width / 2 - thisPlacedItem.Width / 2

 

 

illus_app.ActiveDocument.Artboards.SetActiveArtboardIndex(2)

thisPlacedItem = illus_app.ActiveDocument.PlacedItems().Add

thisPlacedItem.Selected = True



thisPlacedItem.File = "D:\test2.eps"

 

 

How to calculate the top and left coordinates to place the image in the centre of artboard 2 and subsequent artboards.

 

regards,

Sashi

 

 
Replies
  • Currently Being Moderated
    Nov 24, 2011 2:45 PM   in reply to Sashikala Balasubramanian

    get the bounds of each artboard using ArtboardRect property. Then use simple math (left+(right-left)/2) to get the center x position for example. Same for center y position.

     

    then pass this [x,y] position to the Document.ActiveView.CenterPoint property. Now you're ready to place your image, it will go right in the center of the artboard.

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points