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

175
Visualizações
Shapes aren't drawn on the good page when the document setup is 'facing page' in InDesign (CEP/JavaScript)

I am creating an InDesign plugin where one of the features is to draw shapes on a given page.

I get a drawing from the backend with the page number on which it should be drawn.

For this, I do : app.activeDocument.pages[index] to get the page I want.

Unfortunately, I realized that this technique only works when the pages are not facing each other like this :

enter image description here

When the pages are facing each other like this :

enter image description here

, the shapes on page 3 will be drawn on page 2 instead of on page 3.

Here, the drawings are on the right page :

enter image description here

But here, the rectangle isn't on the right page :

enter image description here

I also tried to draw the shape in a raw way by doing app.activeDocument.spreads[indexSpread].pages[1], which should logically write the note on the 2nd page of the board in question except that it is always drawn on the 1st page of the board.

Here is my code to draw the rectangle :

var doc = app.activeDocument;
var page = doc.pages[pageIndex-1];
var myRectangle = page.rectangles.add();
about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

To address pages inside a spread use the page origin coordinates:

app.activeDocument.viewPreferences.rulerOrigin = RulerOrigin.PAGE_ORIGIN;

var doc = app.activeDocument;
var page = doc.spreads[indexSpread].pages[1];
var myRectangle = page.rectangles.add();
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