Skip to main content
Inspiring
April 16, 2024
Answered

Creating a Rectangle and applying a gradient feather with a script

  • April 16, 2024
  • 2 replies
  • 469 views

Hi,

 

On InDesign, I create two documents, A and B.

On document A, I’m using the “app.activeDocument.pages[0].rectangles.add()” to create a new rectangle on the first page.

In document B, I create the same rectangle using the tool (manually).

I export both documents as an IDML and extract the XML files for the same spread, comparing their contents. In the IDML of document A ItemTransform of the rectangle is “1 0 0 1 5 -391” while in document B ItemTransform is “1 0 0 1 0 0”. Also in document A most of the properties like GradientFillStart, GradientStrokeStart, PathPointType, etc values for X and Y are sifted by 5 and -391.

The problem is that when I’m trying to create a GradientFeather using a script providing the proper values for gradientStart, angle, length, etc the result is never correct on Document A but always ok on document B.

I search by printing out all the properties for the two documents, spreads, pages, and rectangles and everything returns the same values for all the properties…

I saw in the IDML’s specs that those two numbers in the ItemTranform are “the horizontal and vertical distances to move the object, relative to the center of the pasteboard”. How can I change that with script thought…

If I change those two values and build back the IDML gradient feather is the same in documents A and B.

 

I’m sending you here the files to reproduce the issue. I have instructions are into the ScriptA.jsx

 

Regards,

 

Jim

This topic has been closed for replies.

2 replies

Participant
October 18, 2024

Thanks but way too complicated and not relevant to the commands availabe in Photoshop Elements.