We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Text is not at center for On-page Reference shape

Hi,

I am encountering a situation where I have to add text in On-page reference shape. When I am creating shape with text and then resizing it, text is not rendered at center of shape.

PFA test case:
On-page reference text Issue.zip (151.7 KB)

Thanks,
Astha

@asthac,
We can formulate the position of text by setting TxtPinX and TxtPinY values in the shapesheet:

[Java]

// set text position 
shape.getTextXForm().getTxtPinX().getUfe().setF("Width/2"); 
shape.getTextXForm().getTxtPinY().getUfe().setF("Height/2"); 

These lines of code do not work in your scenario. This issue has been logged under the ticket ID DIAGRAMJAVA-50545 in our bug tracking system. We have linked your post to this ticket and will keep you informed regarding any available updates.

@asthac,
In reference to the ticket ID DIAGRAMJAVA-50545, please download and try the latest Hotfix version: Aspose.Diagram for Java 17.8.1.

@asthac,
The linked ticket ID DIAGRAMJAVA-50545 has been fixed. Please download and try the new version 17.9 of Aspose.Diagram for Java API.