If you need to resize a Visio page to fit the drawing contents, you may notice some surprising results – your shapes will shift positions. In this post I’ll explain what is observed and how you can work-around an oddity in Visio’s behavior.

This is a relatively subtle behavior and you may not realize this is happening, but if you need to be precise about shape positioning, you should be aware of what is going on.

The Scenario

If you’ve carefully sized and positioned your shapes and then resize the page to fit the contents, you may see that the shapes are no longer positioned in exactly the same place you started.

An Example

Start of with a blank 8.5x11 page in Visio.

Turn on the Size and Position window. This will help make the example and the workaround clear.

Now draw a simple 2 inch x 2 inch rectangle and position it at the bottom left.

Pay close attention to the Size and Position Window

The shape is perfectly placed at (1,1) and this means its lower left corner is at (0,0) and its upper right at (2,2). Everything is now precisely arranged. Our next step is to resize the page to fit the contents.

Also, if you look really closely at the edge of the shape, you’ll notice the edge of the page does not touch the shape.

Here’s a close up…

You’ll notice that there is a roughly 1-pixel space between the page and the shape.

THIS IS CAUSED BY THE LINE PROPERTIES OF THE SHAPE

If you play around with the shape you’ll discover what is going on.

Let’s pick a thicker line weight

And then resize the page to fit contents again …

Look at the Size and Position Window

Again the shape size is preserved, but now the shape is even farther away from where we wanted.

If you find page size you’ll see it is set to 2.11x2.11.

Notice that the gap between the shape and the page is even more pronounced

It’s completely reasonable for a Visio to take into account the line width when calculating the “fit” size for the page. If it didn’t, it would mean edges of shapes wouldn’t correctly be drawn when printed or exported.

So, we’ll have to change our initial expectation – we should expect shapes that don’t have lines will not drift during page resize.

A technical note: Experimentally, if we were to specifically set the line weight (shown in inches below, not points) you’d see this as the page resize behavior.

(Clearly, the extra gap between the page matches the line weight.)

Line Weight

New Shape X

New Shape Y

New Page Size

New Page Width

0.0 in

1

1

2

2

0.1 in

1.1

1.1

2.2

2.2

0.2 in

1.2

1.2

2.4

2.4

0.3 in

1.3

1.3

2.6

2.6

0.4 in

1.4

1.4

2.8

2.8

0.5 in

1.5

1.5

3

3

0.6 in

1.6

1.6

3.2

3.2

0.7 in

1.7

1.7

3.4

3.4

0.8 in

1.8

1.8

3.6

3.6

0.9 in

1.9

1.9

3.8

3.8

1.0 in

2

2

4

4

So, at this point it should be clear that setting a line weight of zero should work. Let’s try it next.

USING THE NO LINE SETTING

We’ll do this in the most direct way possible … by selecting No Line

And then we resize the page and find that …

It did not work. The shape is at (1.0033,1.0033)

Let’s look at the Line Properties for the shape …

The Pattern is set to None – this makes sense. We did select No Line after all.

But the weight is set to the value “01”.

If you click the dropdown arrow and select Custom, you’ll see what specific value this is

Exactly 0.24 points – which corresponds to 0.00333333333333… inches

THE WORKAROUND

You guessed it. You have to specifically set the Line Weight to “0 pt”

And when you click OK, here’s what you’ll see.

The Pattern is set to 01 ( a solid line) and the weight is 0 pt.

And if you resize the page to fit the contents, you’ll get what we originally wanted.

If you set the pattern to None it will still work – they key this is that the weight must be set 0 pt.

WHAT DOES IT ALL MEAN?

If you are wondering why your shapes have “drifted” from their original positions, this may be the cause

When resizing the page to fit the contents, there’s no way to avoid the positions drifting if your shapes have lines that have non-zero weights.

Shapes even with no visible lines will drift – you MUST set the weight to 0 pts.

PARTING THOUGHTS

It would be nice if “No Line” really implemented “no line” as one would expect (pattern = None, weight = 0pt). Of course, there may be some non-obvious reason why Visio behaves this way.