Skip to main content
Participant
February 4, 2025
Answered

Extracting coordinates from XML or idml

  • February 4, 2025
  • 1 reply
  • 322 views

Hello,

I'm trying to extract the (x,y) coordinates and width and height of textboxes and images after exporting as XML or idml. When I export it as HTML I can see the style tag that contains the coordinates in pixels. Where can I find this information in the XML or extracted XML from idml?

 

Example from html:

style="position:absolute;top:28.8px;left:42.6px;"
Correct answer Joel Cherney

Egads. Lots deeper! Marc Autret wrote a whole book about it.

 

Happy reading, Kindl123!

 

 

1 reply

Robert at ID-Tasker
Legend
February 4, 2025

Have you added ".zip" to your IDML file to get to the contents? 

 

And I don't think you'll get coordinates info from exported XML. 

 

Joel Cherney
Community Expert
Community Expert
February 5, 2025

You can't just open it up and find X,Y coordinates, no. But you (not me! looks like a massive slog to my eyes) can find the "ItemTransform" value. It's not trivial to turn that value into a pair of x,y coords, though. Kindl123, have you looked at the IDML specification? I only searched briefly, but in the 8.0 version published in 2012, I found a discussion of "Page Item Geometry" on page 104. I'd copy/paste it here, but for reasons I won't speculate about, the whole PDF is locked down with a password, and I can't copy/paste the relevant bit here. Suffiice it to say that it's Deeper Than It Looks.



Joel Cherney
Community Expert
Joel CherneyCommunity ExpertCorrect answer
Community Expert
February 5, 2025

Egads. Lots deeper! Marc Autret wrote a whole book about it.

 

Happy reading, Kindl123!