Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

141
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!