Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

How to outline text in illustrator scripting

Guest
Apr 16, 2015 Apr 16, 2015

I want to create storke in text in illustrator scripting and found one method too createoutline(),But How i used this method for text outline.

TOPICS
Scripting
4.2K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe
Engaged ,
Apr 17, 2015 Apr 17, 2015

#target illustrator


var idoc = app.activeDocument;

var tf = idoc.textFrames;


for ( t = tf.length-1; t >= 0; t-- ) {

  var text = tf;

  text.createOutline();

}


alert ( "All text converted to outlines." );

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Apr 21, 2015 Apr 21, 2015

Yeah, i used like this. its creating outline but replace text frame to outline .I need textframes and outline both having different colors.

Thanks in advance

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Apr 22, 2015 Apr 22, 2015

Then I suppose you could use:

a for loop to select all of the text items.

app.executeMenuCommand ('copy')

menu command deselect all

the previous for loop to create outlines

menu command past in front

Changing the color of text is a pain in script but you can find an example in this post SpotColor to GrayColor converter (javaScript) starting at line 82 in the script.

Good luck

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
May 11, 2015 May 11, 2015
LATEST

var docRef = app.activeDocument;

var colorForText = new CMYKColor();

    colorForText.black = 0;

    colorForText.cyan = 0;

    colorForText.magenta = 0;

    colorForText.yellow = 0;

   

var colorForTextOutline = new CMYKColor();

colorForTextOutline.black = 100;

colorForTextOutline.cyan = 0;

colorForTextOutline.magenta = 0;

colorForTextOutline.yellow = 0;

var outlineSize = 5;

for (i = docRef.textFrames.length-1; i >=0; i--) {

   

    for (j = 0; j < docRef.textFrames.words.length; j++){

        docRef.textFrames.words.filled = true;

        docRef.textFrames.words.fillColor = colorForText;

    }

   

var outline = docRef.textFrames.duplicate(docRef, ElementPlacement.PLACEATEND);

    for (h = 0; h < outline.words.length; h++) {

        outline.words.filled = true;

        outline.words.fillColor = colorForTextOutline;

        outline.words.stroked = true;

        outline.words.strokeColor = colorForTextOutline;

        outline.words.strokeWeight = outlineSize;

       

        }

//docRef.textFrames.createOutline();

//outline.createOutline();

    }

createOutline(); converts live text to outlines, if you are trying to just create a stroke you have to go about it a different way. This script will take the text and copy it, put it in back, and put a stroke behind on the behind text so it has an effect similar to an offset path. The way I have it leaves the text live, if you were wanting to convert the text to outlines as well I left that part written in the bottom of the script. There is also a StrokeJoin parameter as well.

Hope this helps!

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines