SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to set the zoom level of a Visio document which is shown through the Visio Web Service.


I want to use the 'fit to page' zoom level which is achieved by pressing the button on the right of the toolbar. My first thought was click the button via javascript, but didn't get immediate success and also stumbled across MSDN articles on Objects in the Visio Services JavaScript API, the Vwa.VwaControl.getActivePage Method and the Vwa.Page.setZoom Method.

I can successfully construct a VwaControl object

vwaControl = new Vwa.VwaControl("ctl00_PlaceHolderMain_VisioWebAccess");

but I get null when I call getActivePage() on this control.

I've tried constructing other VwaControl using other ids from the page but none of them are valid - I get an error like "VwaControl does not exist for id {0}". I've tried traversing down the tree from vwaControl._control._zoomControl._fitButton._clickDelegate but I don't know how to fire that delegate.

Has anyone implemented an 'auto zoom to fit' feature in the VisioWebAccess.aspx page?

share|improve this question
up vote 1 down vote accepted

I've given up trying to modify the ASPX to auto-fit the Visio document, but have instead found another solution.

Select 'Fit to Window' in Visio before saving the file. This View preference is saved with the file, and when opened using Visio Web Services the file will be opened in 'Fit to Window' mode.

In the same way, zooming in on a particular part of a drawing and saving will cause it to load with that same zoom.

share|improve this answer

From StackOverflow Add a handler to 'diagramComplete' then try ad get the active page.

function zoomVWAControl()

    vwaControl= new Vwa.VwaControl("WebPartWPQ2");  
    vwaControl.addHandler("diagramcomplete", onDiagramComplete);

function onDiagramComplete()

        vwaPage = vwaControl.getActivePage();
        var zoomLevel = vwaPage.getZoom();
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.