1

I tried to export web map(Esri) with print task service. it works in localhost and in staging.xxx.com(http) too.But in preview.xxx.com(https) , it throws the error 500: Error performing execute operation.

{"error":{"code":500,"message":"Error performing execute operation","details":[]}}

I can't figure out what's happening , staging uses http and preview uses https , that's the only difference.

Here's my code

        var printTask = new esriLoader.PrintTask(PrintTaskServiceUrl);
        esriLoader.Config.defaults.io.proxyUrl = proxyUrl;
        esriLoader.Config.defaults.io.alwaysUseProxy = true;
        var template = new esriLoader.PrintTemplate();
        template.exportOptions = {
            width: 1015,
            height: 633,
            dpi: 96 // if 200 ,map image will get good quality
        };
        template.format = "JPG";
        template.layout = "MAP_ONLY",
        template.preserveScale = false;
        template.showLabels = true;
        template.showAttribution = false;

        template.layoutOptions = {
            "legendLayers": [], // empty array means no legend
            "scalebarUnit": "Miles",
            "copyrightText": "<div>xxx</div>",
        }
        var params = new esriLoader.PrintParameters();

        params.map = map;
        params.template = template;

        printTask.execute(params, success, error);
  • What version of the javascript api are you using? 2.8 seemed to have some issues that upgrading to 3.2 fixed. See this question from SO: stackoverflow.com/questions/12431283/… – MaryBeth Mar 30 '16 at 12:44
  • I am using the version 3.14 – AhammadaliPK Mar 30 '16 at 12:47
  • I don't think it is a problem , cause it works in localhost and staging perfectly. – AhammadaliPK Mar 30 '16 at 13:17
0

I found the issue , Esri will not support GIF image when exporting map.When I debug , the layer details was sending with a url of image(gif), and issue solved when I replaced the gif with a png..

{
        "id": "userLocation",
        "opacity": 1,
        "minScale": 0,
        "maxScale": 0,
        "featureCollection": {
            "layers": [{
                "layerDefinition": {
                    "name": "pointLayer",
                    "geometryType": "esriGeometryPoint"
                },
                "featureSet": {
                    "geometryType": "esriGeometryPoint",
                    "features": [{
                        "geometry": {
                            "x": 76.299399,
                            "y": 9.963090099999999,
                            "spatialReference": {
                                "wkid": 2226
                            }
                        },
                        "symbol": {
                            "angle": 0,
                            "xoffset": 0,
                            "yoffset": 0,
                            "type": "esriPMS",
                            "url": *"https://example.mine.com/Images/blue_marker.png"*,
                            "width": 26.25,
                            "height": 26.25
                        }
                    }]
                }
            }]
        }
    }

Issue resolved when I changed to gif to png https://example.mine.com/Images/blue_marker.png

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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