AnsweredAssumed Answered

All layers not displaying in pdf while i am trying to print

Question asked by mbabar@alletec.com on Jan 31, 2016

Hi All,

    I want to print the map with 3 layers (base layer , graphic layer that display the point and a graphic layer to display line) my map created successfull doesnt issue here,

 

public void CreateBaseMapLayer()

        {

            //Create basemap Layer

            var newBasemap = new Esri.ArcGISRuntime.Layers.ArcGISTiledMapServiceLayer();

            // Set the ServiceUri with the url defined for the ComboBoxItem's Tag

            newBasemap.ServiceUri = "http://services.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer";

            // Give the layer the same ID so it can still be found with the code above

            newBasemap.ID = "BaseMap";

            MyMap.Layers.Insert(0, newBasemap);

        }

        public void CreatePointLayer(List<Esri.ArcGISRuntime.Geometry.MapPoint> points)

        {

            var graphiclayer = new Esri.ArcGISRuntime.Layers.GraphicsLayer();

            graphiclayer.ID = "PointLayer";

            // Create Graphic for point

            var graphic = new Esri.ArcGISRuntime.Layers.Graphic();

            //Add list of Map Points

            graphic.Geometry = new Esri.ArcGISRuntime.Geometry.Multipoint(points);

            graphic.Symbol = new Esri.ArcGISRuntime.Symbology.SimpleMarkerSymbol() { Color = Colors.Red, Size = 20, Style = Esri.ArcGISRuntime.Symbology.SimpleMarkerStyle.Circle };

            graphiclayer.Graphics.Add(graphic);

            // Insert the new basemap layer as the first (bottom) layer in the map

            MyMap.Layers.Insert(MyMap.Layers.Count, graphiclayer);

        }

        public void CreateLineLayer(List<Esri.ArcGISRuntime.Geometry.MapPoint> points)

        {

            var graphiclayer = new Esri.ArcGISRuntime.Layers.GraphicsLayer();

            graphiclayer.ID = "GraphicLayer";

            // Create Graphic for Line

            var graphic = new Esri.ArcGISRuntime.Layers.Graphic();

            graphic.Geometry = new Esri.ArcGISRuntime.Geometry.Polyline(points);

            graphic.Symbol = new Esri.ArcGISRuntime.Symbology.SimpleLineSymbol() { Color = Colors.Blue, Width = 2, Style = Esri.ArcGISRuntime.Symbology.SimpleLineStyle.Solid }; ;

            graphiclayer.Graphics.Add(graphic);

            MyMap.Layers.Insert(MyMap.Layers.Count, graphiclayer);

        }

 

But when i try to print this map with pdf formate ... the point layer is not visible .

 

here is the code to print....

 

 

public async void PrintMap()

        {

            PrintTask _printTask = new PrintTask(new Uri("http://sampleserver6.arcgisonline.com/arcgis/rest/services/Utilities/PrintingTools/GPServer/Export%20Web%20Map%20Task"));

         

            try

            {

                PrintParameters printParameters = new PrintParameters(MyMap.Layers, new Envelope(675832, 223280, 677664, 219837, new Esri.ArcGISRuntime.Geometry.SpatialReference(21781)))

                {

                    ExportOptions = new ExportOptions() { Dpi = 96, OutputSize = new Size(MyMapView.ActualWidth, MyMapView.ActualHeight) },

                    //LayoutTemplate = string.Empty,

                    LayoutOptions = new LayoutOptions() { ScaleBarOptions = new ScaleBarOptions() { MetricUnit = ScaleBarOptions.MetricUnits.Meters } },

                    LayoutTemplate = "Letter ANSI A Portrait",

                    Format = "PDF"

                };

                var result = await _printTask.PrintAsync(printParameters);

                Process.Start(result.Uri.AbsoluteUri);

            }

            catch (Exception ex)

            {

                MessageBox.Show(ex.Message, "Sample Error");

            }

        }

 

 

can anyone help me?

thanks in advanced

Outcomes