AnsweredAssumed Answered

WPF PrintResult null

Question asked by emanuell on Feb 2, 2016

Hello

 

Actually i want to print the map via the PrintTask.

 

This is my code:

 

PrintTask printTask;
....
printTask = new PrintTask("http://myserver/arcgis/rest/services/Utilities/My_Printing/GPServer/Export%20Web%20Map%20Task");
printTask.DisableClientCaching = true;
printTask.ExecuteCompleted += printTask_PrintCompleted;
printTask.GetServiceInfoCompleted += printTask_GetServiceInfoCompleted;

 

Button Click Event:

if (printTask == null || printTask.IsBusy) return;

PrintParameters printParameters = new PrintParameters(BaseMap)
{
 ExportOptions = new ExportOptions() { Dpi = 96, OutputSize = new System.Windows.Size(BaseMap.ActualWidth, BaseMap.ActualHeight) 
 LayoutTemplate = "A4",
 Format = "PDF",
};

printTask.ExecuteAsync(printParameters);

 

PrintCompleted:

private void printTask_PrintCompleted(object sender, PrintEventArgs e)
{
    //e.PrintResult is NULL WHY?
}

 

My BaseMap:

<esri:Map x:Name="_baseMap" Margin="0" IsLogoVisible="False" MinimumResolution="0.13" SnapToLevels="False" ZoomDuration="0:0:0.5" P    anDuration="0:0:0.5" Grid.Row="2" Grid.Column="0">
            
            <esri:Map.Layers>                
                <esri:ArcGISTiledMapServiceLayer x:Name="_baseTiledLayer"  ID="BaseTiledLayer" Url="http://server/arcgis/rest/services/..." />
                <esri:ArcGISDynamicMapServiceLayer x:Name="_ServiceLayer" ID="serviceLayer" Visible="False" Url="http://server/arcgis/rest/services/..."></esri:ArcGISDynamicMapServiceLayer>

                <esri:GraphicsLayer x:Name="_lineLayer"  ID="LineLayer">
                </esri:GraphicsLayer>

                <esri:GraphicsLayer x:Name="_pointLayer" ID="PointLayer">
                </esri:GraphicsLayer>
            </esri:Map.Layers>
         
        </esri:Map>

Outcomes