Skip to main content
Known Participant
October 17, 2010
Question

Drawing a rectangle of exact size of the artboard?

  • October 17, 2010
  • 2 replies
  • 14898 views

Has anybody written a JS script to to draw a rectangle on an active document which would be exact size as the document's artboard?

I find it very inaccurate and cumbersome trying to draw such rectangle by hand.

Please let me know where such JS code can be found. I have not done any Illustrator scripting beyond the "Hello world".

Thanks

franK

This topic has been closed for replies.

2 replies

PhyonKatsutoshi
Participant
April 15, 2015

Hi, Is there anyway to make the rectangle target Bleeding Size instead of Artboard Size?

Participating Frequently
April 15, 2015

Hi PhyonKatsutoshi,

It's been a long time since I was busy with it and have been out of it for a long time but my first thought is, since bleed sizes are pretty constant (I myself always use 3mm) you could just subtract that number from the position and add it 2x to the size.

So, in my 3 mm case, subtract the 3mm from the top and the left equations and add 6 to the width and the height.

Sorry if my suggestion is "too practical"

PhyonKatsutoshi
Participant
April 15, 2015

Dude to the reason that my bleeding size are depending on the artboard size, if the artboard is A3 or A4, 5mm would usually do, but if the artboard is 60inches, usually would need 1inch bleeding instead, so it gets very annoying when having too much item getting snapped when trying to draw the circle, plus this would speed up my workflow with script

Inspiring
October 18, 2010

#target illustrator var docRef = app.activeDocument; var artboardRef = docRef.artboards; for(i=0;i<artboardRef.length;i++){      var top=artboardRef.artboardRect[1] ;      var left=artboardRef.artboardRect[0];      var width=artboardRef.artboardRect[2]-artboardRef.artboardRect[0];      var height=artboardRef.artboardRect[1]-artboardRef.artboardRect[3];      var rect = docRef.pathItems.rectangle (top, left, width, height);      rect.fillColor = rect.strokeColor = new NoColor();      }

[CS4/CS5] If the document have 20 artboards, you will get 20 rectangles as well.

Participating Frequently
May 12, 2011

Cool! Was searching for a while for this now

I set up one for the exact artboard size to use for for instance Layer Clipping masks and a seperate one which includes the size of the bleed for backgrounds and such.

Thanks a lot for the example!