How to remove the 'whitespace' of a diagram in a page

Dear Support,

I am using Aspose.Diagram for .NET version 24.8.0 in C#.

I have a question regarding to remove the ‘whitespace’ of a diagram in a page.

In Visio this was done by selecting all the shapes on the page and copy them to a new page, so that the ‘virtual’ rectangle is positioned at the top left corner of the page.

My question is how to do this with Aspose.Diagram. So all the shapes have to move somewhat to the left and top so that there is no ‘whitespace’ in the diagram of the page.

I hope the hear soon from you to get some hints.

With Kind Regards,

Thierry Knijff

@tkn1967

Can you please provide more details about the specific version of Aspose.Diagram you are using and any code snippets you have tried so far?

I am using Aspose.Diagram for .NET version 24.8.0

I have nothing tried yet. I would like to have some suggestions on how to move the diagram to the top, left of the page so the ‘whitespace’ is removed.

@tkn1967
Please try the following code: First, group the required shapes, and then you can perform subsequent operations such as moving or copying this group shape to a new page, or directly generating an image.

        var list = new List<Shape>();
        foreach (Shape shape in diagram.Pages[0].Shapes)
        {
            list.Add(shape);
        }
        Shape s = diagram.Pages[0].Shapes.Group(list.ToArray());

Thanks.

1 Like