Export Web Map Online

This sample demonstrates printing a map using a PrintTask. To use the sample, specify the print settings (Layout template and Format) using the dropdowns and click the Export Map button to generate a printout of the map. The printout will be displayed as appropriate for the format chosen. In the code-behind, a PrintTask is used to generate a printable file from the map. The layout and format will match those specified in the sample, and a URL to the printable file is returned. The sample then navigates to that URL to show the printable map.

Download Sample Application
XAML C# VB.NET
<UserControl x:Class="ArcGISWPFSDK.ExportWebMap"
       xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:esri="http://schemas.esri.com/arcgis/client/2009">
    <Grid x:Name="LayoutRoot" Background="White">
        <esri:Map Name="MyMap" UseAcceleratedDisplay="True" Extent="-10929488.234,4525208.388,-10906776.553,4535252.104">
            <esri:ArcGISTiledMapServiceLayer Url="http://server.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer" />
            <esri:ArcGISDynamicMapServiceLayer Url="http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/Petroleum/KSFields/MapServer" />
            <esri:FeatureLayer Mode="OnDemand" Url="http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/Petroleum/KSWells/MapServer/0"
                               DisableClientCaching="True" />
        </esri:Map>
        <Border BorderBrush="Gray" BorderThickness="1" Background="White" HorizontalAlignment="Left" 
                VerticalAlignment="Top" Margin="15" Padding="10">
            <Border.Effect>
                <DropShadowEffect/>
            </Border.Effect>
            <Grid>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition />
                    <ColumnDefinition />
                </Grid.ColumnDefinitions>
                <Grid.RowDefinitions>
                    <RowDefinition/>
                    <RowDefinition/>
                    <RowDefinition/>
                </Grid.RowDefinitions>
                <TextBlock Text="LayoutTemplates" Grid.Row="0" Grid.Column="0" Margin="2"/>
                <ComboBox x:Name="LayoutTemplates" Grid.Row="0" Grid.Column="1" Width="100" Margin="2">
                    <ComboBox.ItemTemplate>
                        <DataTemplate>
                            <TextBlock Text="{Binding}"/>
                        </DataTemplate>
                    </ComboBox.ItemTemplate>
                </ComboBox>
                <TextBlock Text="Formats" Grid.Row="1" Grid.Column="0" Margin="2"/>
                <ComboBox x:Name="Formats" Grid.Row="1" Grid.Column="1" Width="100" Margin="2">
                    <ComboBox.ItemTemplate>
                        <DataTemplate>
                            <TextBlock Text="{Binding}"/>
                        </DataTemplate>
                    </ComboBox.ItemTemplate>
                </ComboBox>
                <Button x:Name="Print" Content="Export Map" Click="ExportMap_Click" 
                        Grid.Row="2" Grid.Column="0" Margin="2"/>
            </Grid>
        </Border>
    </Grid>
</UserControl>

Sample code usage restrictions
5/16/2014