Skip to main content
Zective
Participant
September 2, 2024
Question

How to Determining TextFrame Position in IDML Using XML and Python: Handling Negative Values

  • September 2, 2024
  • 2 replies
  • 338 views

After extracting the IDML file, I checked the `TextFrame` elements in the `Spreads.xml` file.

 

However, when I calculate the position using a matrix, I get negative values.

 

The document size and the `TextFrame` size are calculated correctly, but I’m not sure how to properly calculate the position.

 

Can you help me with this?

 

 

* I am using Python.

 

 

<Title renamed by MOD>

This topic has been closed for replies.

2 replies

Marc Autret
Legend
September 3, 2024

Hi,

Coordinate spaces in IDML are detailed in the specification. The origin of the Spread space is its center point:

 

Then you use ItemTransform and PathGeometry elements to get space-relative coordinates, in pt.

 

More on this topic:

https://indiscripts.com/blog/public/data/coordinate-spaces-and-transformations-5/CoordinateSpacesTransfos01-05.pdf

 

Best,

Marc

Robert at ID-Tasker
Legend
September 2, 2024

.