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

Free Support Forum - aspose.com

Need to draw a straight connector in between the shapes

Hi Team ,

I need to draw the straight connectors in between the shapes. Currently I am not able to draw the straight connectors rather than bending connectors.
Can you please suggest the solution ?

image.png (5.3 KB)

What I need is the straight connectors as shown below.

image.png (6.0 KB)



We have logged an investigation ticket as DIAGRAMJAVA-50818 in our issue tracking system for the sake of your requirements. We will look into its details and keep you posted with the status of its correction. Please spare us some time.


Please try to use following in order to draw a straight connector:


Hi @asad.ali

Thanks for sharing the solution . I am getting the below exception after adding the property.

Shape connector = new Shape();
// connector.getText().getValue().setWholeText(edge.getConnectorInfo());
connecter = pagetemplate.addShape(connector, connectorMaster);
Exception :
java.lang.NullPointerException: null
	at com.aspose.diagram.dv.c(Unknown Source)
	at com.aspose.diagram.Shape.setConnectorsType(Unknown Source)

Can you please assist more ?



Can you please share the complete sample code snippet that we can run and reproduce the issue in our environment? We will further proceed to assist you accordingly.

This is my first attempt at helping in the community but here goes. I AM using the “ConnectorsTypeValue.STRAIGHT_LINES” property successfully. Your syntax appears correct. In your import statement(s), use:

import com.aspose.diagram.*;

I am using aspose version 21.9.

One other thing. This may not be related to the problem you are experiencing, but In order for it to work, I had to add the connector to the page first (the line you have just below your bold line --not sure why that would be the case) but if I did not, I got the error:
Cannot invoke “com.aspose.diagram.Shape.getGeoms()” because the return value of “com.aspose.diagram.Shape.getMasterShape()” is null


Thanks for sharing the information. It would definitely help the users who have similar requirements and facing similar issue.

@richardcromer Thanks for sharing the solution. I tried changing the aspose version , but still the issue remains same.

Make sure you have debug flag turned on in whatever ide or build system you are using. Unknown source may be replace with actual error.


We have logged an investigation ticket as DIAGRAMJAVA-50839 in our issue tracking system to investigate the reasons behind above exception and will inform you as soon as we have some definite updates regarding ticket resolution. Please spare us some time.

We are sorry for the inconvenience.

Please try the latest fix 21.11.1 We have fixed this issue in the fix.
aspose-diagram-21.11.1-java.zip (4.0 MB)


The issues you have found earlier (filed as DIAGRAMJAVA-50839) have been fixed in this update. This message was posted using Bugs notification tool by philip.zhou