1 Reply Latest reply on May 18, 2012 6:41 PM by Michael L Hale

    How to Generate Barcode (3of9 Barcode or any of its variations) in a simple text layer?

    apmaui808 Level 1

      Is there a way to get the font names used in a computer (C:\windows\fonts), which can be used in Javascript line? I have the barcode font but I don't know its name for Javascript to recognize.


      see line on myTextRef.font below:


      // make a variable for the active document

      var docRef = activeDocument;


      // Create a text layer at the front

      var myLayerRef = docRef.artLayers.add();

      myLayerRef.kind = LayerKind.TEXT;

      myLayerRef.name = "Filename";


      // this is the real text layer describing it as a text item

      var myTextRef = myLayerRef.textItem;


      // Set font size in Points

      myTextRef.size = 24;


      //Can a text or numbers be converted to a Barcode?

      myTextRef.font = "Arial";


      //Set text colour in RGB values

      var newColor = new SolidColor();

      newColor.rgb.red = 255;

      newColor.rgb.green = 255;

      newColor.rgb.blue = 0;

      myTextRef.color = newColor;


      // Set the position of the text - percentages from left first, then from top.

      myTextRef.position = new Array( 50, 50);

      myTextRef.justification = Justification.CENTER    


      // If Bold Font

      myTextRef.style = "BOLD";


      // Set the Blend Mode of the Text Layer. The name must be in CAPITALS - ie change NORMAL to DIFFERENCE.

      myLayerRef.blendMode = BlendMode.NORMAL;


      // select opacity in percentage

      myLayerRef.opacity = 100;