Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

215
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda