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.
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.
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.
Before we do that let’s set an expectation on what we desire
- the page should be 2 inches x 2 inches (this the shape covers the entire page)
- the shape should continue to stay at position (1,1)
Open the Page Setup Dialog and navigate to the Page Size tab
Select the Size to fit drawing contents option
And once you click on it …
The first sign of trouble: Look at the Drawing Page values …
It says “2.02x2.02 in”. This is not what we desired.
Now notice the Size and Position Window
The shape has the same size (2x2 inches).
But it is positioned at (1.01,1.01) and not (1,1) as we desired.
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.)
|New Shape X||New Shape Y||New Page Size||New Page Width|
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
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.
- 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.