|KB no longer maintained - MapViewer is a Legacy Product. Legacy Products are still supported, but no longer receive new features or updates. Many of MapViewer's features have been moved to Surfer. Please contact email@example.com with any questions.|
The map can be made to fill the page in MapViewer's Scripter. In the program, the map will automatically scale to fill the page when you import new objects. But, in the script, you need to tell the program to do this after you load the map. Use the SetScale command to change the map scale to fit the page.
To run this script:
- Copy the text below, from the Sub Main start line to the End Sub end line.
- In a Windows Explorer window, navigate to C:\Program Files\Golden Software\MapViewer 8\Scripter.
- Double click on Scripter.exe to launch Scripter.
- Press Ctrl+A to select all of the existing lines.
- Press Ctrl+V to paste your copied script over top of these existing lines.
- Click Script | Run to run the script.
Dim mvApp, Plot As Object
Set mvApp = CreateObject("MapViewer.Application")
mvApp.Visible = True
Set Plot = mvApp.Documents.Add(mvDocPlot)
'Declares the Polygon object and declares the x,y coordinates of the polygon vertices as an array of doubles
Dim Polygon As Object
Dim Coords(7) As Double
Coords(0) = 5: Coords(1) = 4
Coords(2) = 3: Coords(3) = 6
Coords(4) = 6: Coords(5) = 7
Coords(6) = 5: Coords(7) = 4
Set Polygon = Plot.Layers.ActiveLayer.Shapes.AddPolygon(bSpline:=False, Vertices:=Coords)
'Wait 2 seconds so you can see the size of the shape before the scale is changed
'Change the scale to fit the page
Updated February 16, 2015