How to draw a graphicLines in InDesign using CEP / ExtendScript?

243 views Asked by At

I saw that there was a similar question but my problem is not the same :

This is how I create my graphicLines :

var myArr = [
   [x1, y1],
   [x2, y2],
   ...
]
// Get the active document
var doc = app.activeDocument;

// Get item from the page
var page = doc.pages.item(0);

var line = page.graphicLines.add();
line.paths.item(0).entirePath = myArr;

I should have this (the line circled in blue) :

enter image description here

But I get this (the rectangle circled in blue) :

enter image description here

This rectangle appears when I click on the focus, otherwise it is nonexistent. enter image description here

The rectangle seems to be the size of the line and is well positioned but I did not get the line I wanted. What did I forget ?

1

There are 1 answers

0
Yuri Khristich On BEST ANSWER

Try to add this line at the end of your snippet:

line.strokeWeight = 1;