Skip to main content
Inspiring
March 23, 2022
Question

Wrong X,Y values for Texts

  • March 23, 2022
  • 4 replies
  • 398 views

Hello, 

I'm using indesign sdk 16, If I try to get X,Y positions using GetXPosition() and GetYPosition()/GetCompositionYPosition().

Sometimes I get bad values if I use the indd project file, these values are far better if I use the idml project file instead.
Does anyone have any idea about this problem and how to actually fix it?

Is the indd broken? 

Sometimes even if I use the idml the result is very bad.

Thanks.

This topic has been closed for replies.

4 replies

Amine9Author
Inspiring
March 29, 2022

Hello guys,

I'd like to add a detail that can help debug this issue; If I duplicate the page that has this problem, the issue doesn't appear in the duplicated page and all values X and Y are 100% correct.

Thanks.

Legend
March 25, 2022

Composition is a time intensive, therefor damage is immediately recorded but recompose is a deferred task.

Before accessing results ensure the composer has completed. Watch out for interfaces and methods with "Recompose" in their name.

 

 

Olivier Beltrami
Legend
March 24, 2022

Hello,

If you use functions such as GetPathBoundingBox() then these X values are with respect to the left side of the pasteboard. So, to these values, you need to add the page width (facing pages documents) or a half page width (non-facing pages).

Note that if the document is re-sized, the pasteboard is not also re-sized, and the X position functions fail. If your code uses the getting and setting of the X position of objects, then make sure that documents are not re-sized.

Very best regards,

Olivier

m1b
Community Expert
Community Expert
March 23, 2022

Hi @Amine9, I use the scripting API, not the SDK, so I can't answer, but it might be helpful if you could include a test file in which you can demonstrate and reproduce the erroneous results. There might be reasons why different values are given—eg. differing coordinate spaces, or, I don't know, auto-sizing context. A demo file might help a lot.

- Mark

Amine9Author
Inspiring
March 24, 2022

Hello Mark, 

Thanks for the quick response, I'm not sure if I'm able to share a code snippet, will check and get back to you.

I don't think it's a scaling problem, because the X,Y values I received are all negative.

Thanks.