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

152
Visualizações
How to set default document effects using CEP/JavaScript?

I'm building an application which is drawing many objects (rectangles, lines, circle, etc.) in an Indesign document using CEP/JS. The issue I have is that all objects I’m adding are inheriting document’s default transparency settings, etc. which is a big issue as these settings are not under control (can be different on any document).

So, my first solution to this is to explicitly define all attributes for any object I’m drawing to overcome this and this works ok but the issue I have now is performance as I discover that settings all these objects attributes explicitly is taking a lot of time (and CPU). As a reference, I’ve to set around 40 attributes per object. On a test document with 100 objects to draw, it takes around 10 seconds and on the same document with exact same objects + settings 40 attributes, it goes to 40 seconds for the same job.

So question is :

  • Is it possible to prevent CEP to use the document default attribute when drawing new objects?
  • Is there a way to store the default values from the document in a variable, reset all the default values in the document prior to draw all my objects and then set the initial values back when done (to avoid having to set 40 attributes for every objects in a massive loop).

enter image description here

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

I applied @RobC and @Yuri Khristich's solution which is to use the ObjectStyle of type 'None' on the various items I draw. It still takes time but less than before.

Here is the example :

https://paste.ee/p/3fW9a

var doc = app.activeDocument;

// 1. Obtain a reference to the '[None]' Object Style.
var noneObjectStyle = doc.objectStyles.itemByName('[None]');

// 2. Draw a rectangle
var rectangle = doc.pages[0].rectangles.add({
 geometricBounds: [0, 0, 50, 50],
 appliedObjectStyle: noneObjectStyle // <-- 3. Set its Object Style to [None].
 // ...
});
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