Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

223
Vistas
indesign script to add a polygon (irregular shape textframe) and add text to it

I need an Indesign script to add a irregular textframe (polygon) to page and add text content to it. I have so far this code. but it is a regular text frame.

       var doc = app.documents.add();

       var textFrame = doc.textFrames.add();

       textFrame.properties =

       {

        geometricBounds : [ 0,0,100,100 ],

        strokeWidth : 0,

        fillColor : "None",

        contents : "Hello World!"
       }

I can also add this polygon but I can't add text to it.

       var doc = app.documents.add();

       var polygon = doc.polygons.add();
       var points = [
       [100,100],
       [150,100],
       [200,200],
       [120,150],
       [100,100],

]
       
polygon.paths.item(0) = points;
        

thanks for your help!

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Not sure if this is an optimal way for your workflow but it can be done this clumsy way:

var doc = app.documents.add();

var polygon = doc.polygons.add();
var points = [
    [100,100],
    [150,100],
    [200,200],
    [120,150],
    // [100,100], // this point doesn't need, since a polygon is a closed path
];
polygon.paths[0].entirePath = points;

polygon.contentType = ContentType.TEXT_TYPE;    // convert the polygon into a text frame
var poly_textFrame = doc.textFrames.lastItem(); // get the last text frame
poly_textFrame.contents = 'Hello World!';       // change contents of the frame

The problem of this approach is that I'm not sure if the new text frame is always a last item within of the text frames collection. It needs to be tested in vivo.

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda