Take the 2-minute tour ×

I need to essentially draw a print-ready grid using some kind of scripting language. I have the following requirements:

  1. It must be 300dpi.
  2. It must be size A4.
  3. It must have solid lines every 21.1666667 millimeters both horizontally and vertically.
  4. It must have a dot every 2.11666667 millimeters in every direction inside the lines.

Is there a way for me to script something like this? I'm a programmer, not a designer, but someone recently asked me for this. Can I use something like JavaScript to automate the drawing of these lines and dots? Otherwise, this could literally take years.

share|improve this question
Why Illustrator and why script it if it's the same every time? –  martineau May 18 '12 at 0:43
add comment

2 Answers

up vote 3 down vote accepted

In the very old version of Illustrator I have it says this in the Help: enter image description here

As you [may] be able to see, it says you can write scripts using JavaScript, AppleScript, or Microsoft Visual Basic.

Alternatively, from what you've described, I don't think creating what you want in Illustrator manually would be as time consuming as you think in the case because of its Repeat Transformation with Copy feature or possibly by creating and using one or more Actions to help with the repetitive parts.

share|improve this answer
Since whoever downvoted this didn't bother to leave a comment I don't understand what their problem was because it answers the OP's question which was "Is there a way for me to script something like this?". –  martineau May 18 '12 at 0:50
If you remove the screenshot, your answer is extremely vague. Improve the answer by giving more context. You do not have to write down all the information in the screenshot, but you could recap some of the important details. For example, @TK asked about JavaScript, so you could point out the fact that Illustrator supports JavaScript. –  iglvzx May 18 '12 at 1:01
@iglvzx: OK, point made. See updated version. –  martineau May 18 '12 at 1:14
Also worth pointing out that the VB API essentially means a COM programming api so you can wirte exactly the same script thet in VB in c#, c++, powershell, python or nearly any language you wish. –  joojaa Jul 1 '13 at 8:58
add comment

Illustrator can read and interpret PostScript files and what you want to do could easily be done in that language. Since you're a programmer it shouldn't be too hard to figure out.

To do it that way you'll need to also specify the line-width or -weight and possibly the diameter or radius of the dots (unless you use some kind of pattern fill) because a single dot at 300 dpi is almost invisible. You probably will also want or need to allow for a margin on all four edges of the page.

share|improve this answer
Since you're a programmer it shouldn't be too hard to figure out. - Postscript is an odd language, writing this in postscript has a decent learning curve. –  Rich Homolka May 17 '12 at 21:18
@Rich Homolka: It wouldn't take much fill a page with a dot pattern and then draw a grid on top of it in PostScript. The main thing weird about it is the postfix notation, but I found it relatively easy to master. Also PostScript was designed to produce print-ready graphics. –  martineau May 18 '12 at 0:41
It's probably easiest to do this in SVG. You can use mm to specify positions/widths/etc. and use the line element to draw the grid. Then just print at your desired resolution. Though both SVG and PotScript are very well supported, and it's easy to convert between the two. –  Lèse majesté May 18 '12 at 1:26
Yes, it would be fairly easy to do in SVG, too. I'd like to point out that since "programs" in both are essentially just text files, one could write a separate program/script in just about any language that generated the code necessary in the language selected to produce the desired graphics. –  martineau May 18 '12 at 14:03
Does SVG support print sizing parameters? IE: I need to size it in inches/millimeters, not pixels, if possible. –  Naftuli Tzvi Kay May 18 '12 at 16:50
add comment

Your Answer


