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

Free Support Forum - aspose.com

Connector line spacing to small

How do I force more distance between horizontal and vertical line segments in aspose java? Or even in the application?

image.png (43.0 KB)


We need to investigate these requirements. Can you please provide sample file and the code snippet you used to create it? We will log an investigation ticket and share the ID with you.

This is the file after I created it:

diagram.zip (189.5 KB)

If you select All and change select the right click menu item “Right Angle Connectors” you will see the result.

I create a number of connections for each node along the top and the bottom using:

private static Connection makeAnchorPoint(Shape shape, String name, String xPositionString, String yPositionString) {
	Connection connection1 = new Connection();
	int ix = shape.getConnections().add(connection1);
	anchorIndex.put(name, ix);
	return connection1;

I then use this to create the connector:

					toId, toAnchorIndex, 

Then I mark the connector line segment for deletion:

public static void markOriginalLineForDeletion(Shape arcShape, boolean dbArcInteresting) {
	for(int i = 0; i < arcShape.getGeoms().get(0).getCoordinateCol().getLineToCol().getCount(); i++) {
		LineTo lineToDelete = arcShape.getGeoms().get(0).getCoordinateCol().getLineToCol().get(i);

Finally I add new line segments:

public static void addLineTos(Shape arcShape, List<Point2D> arcPoints, boolean dbArcInteresting) {
	ModelDebug.DBO(DB_CONNECTORS_LABELS,dbArcInteresting, ()->"\taddLineTos arcPoints:" + dumpList("",arcPoints));
		DoubleValue finalX = new DoubleValue(point.getX(), MeasureConst.IN) ;
		DoubleValue finalY = new DoubleValue(point.getY(), MeasureConst.IN) ;
		LineTo lineToVertice = new LineTo();
		// Set X value
		// Set Y value
		// Add connector geometry

And it looks as you see it, but when I reformat the entire graph, the lines end up too close together.

Please try this sample code to set space distance of shapes
// initialize auto space options
AutoSpaceOptions atopt = new AutoSpaceOptions();
// set horizontal and vertical distances
atopt.setDistanceInHorizontal( 2);
atopt.setDistanceInVertical( 2);
// set auto space
ShapeCollection SrvsCollection = page.getShapes();

        page.autoSpaceShapes(page.getShapes(), atopt); 


ShapeCollection SrvsCollection = page.getShapes();

I don’t understand that line.


Apparently, this line does not seem to take any part in the suggested code snippet. The code snippet might be a part of some project and that line just got included. Weren’t you able to achieve your requirements? Please share in case you have some concerns.