Free Support Forum - aspose.com

Read Shape Text using Apsose.Diagram for Java - How to get the text position

There are three shapes in the file below, the position of the text is different.
For example, the first text is under the shape, The second text is on top of the shape
So how to get the text position of these shapes?

test1.zip (121.4 KB)

@dongshuai

Would you kindly share that in which platform (.NET/Java) you are using the API?

I am use Java

@dongshuai

We are looking into this and will get back to you shortly.

@dongshuai

Please use following code snippet to achieve your requirements:

com.aspose.diagram.Diagram diagram = new com.aspose.diagram.Diagram(dataDir + "");
for (com.aspose.diagram.Page page:(Iterable<com.aspose.diagram.Page>) diagram.getPages()) {
  for(com.aspose.diagram.Shape shape:(Iterable<com.aspose.diagram.Shape>) page.getShapes()){
    double xpin = shape.getTextXForm().getTxtPinX().getValue();
    double ypin = shape.getTextXForm().getTxtPinY().getValue();
   }
}

thank you, it is very helpful to me