PrintTask with GraphicsLayer

1256
4
12-10-2012 10:53 AM
RichardKing
New Contributor
If I have any graphics in my graphics layer, my print task wont work. If I clear the graphics then it works.

 
   var date = new Date();
    var layoutOptions = { 
         titleText: "Map Title", 
         scalebarUnit: 'Miles', 
         authorText: "Author Name", 
         copyrightText: "2012 Copyright", 
         legendLayers: [] 
    };
    var layout = document.getElementById("PRINT_LAYOUT");
    var format = document.getElementById("PRINT_FORMAT");

    var printTemplate = new esri.tasks.PrintTemplate();
    printTemplate.format = format.options[format.selectedIndex].value;
    printTemplate.layout = layout.options[layout.selectedIndex].value;
    printTemplate.layoutOptions = layoutOptions;
    printTemplate.preserveScale = true;

    graphicsLayer.clear();
    var printParams = new esri.tasks.PrintParameters();
    printParams.map = map;
    printParams.outSpatialReference = map.spatialReference;
    printParams.template = printTemplate;

    var printUrl = "...myUrl...";
    var printTask = new esri.tasks.PrintTask(printUrl);

    printTask.execute(printParams, function (result) {
        PrintButton.src = oldSrc;
        window.open(result.url + "?timestamp=" + (new Date().getTime()));
    }, function (error) {
        PrintButton.src = oldSrc;
        var a = error;
        alert(a);
    });

Has anyone else ran into this problem?

I am using JavaScript API 3.1
0 Kudos
4 Replies
derekswingley1
Frequent Contributor
What is the error you're seeing (check your browser's dev console)?

Have you set up a proxy?
0 Kudos
DennisHunink
New Contributor III
Did you in the end found a solution? I would be very interested to see it since i'm running into the same problem
0 Kudos
GaneshSolai_Sambandam
New Contributor III
Did you in the end found a solution? I would be very interested to see it since i'm running into the same problem




Hi Derek
I am experiencing the same problem with my graphic layer on the print pdf map. When graphics added to the map, the print widget doesn't work, when I clear the graphic layer, the print widgets works printing all the other dynamic layer legends.

The error I get from Json response, when I add the graphic layer to map is

{"error":{"code":400, "message":"unable to complete operation.", "details":["Error exectuing tool.: Layer\"_exploreKentGraphicsLayerId\": Unsupported 'type' in symbol: esriCLS.\nLayer\"_exploreKentGraphicsLayerId\nFailed to execute (Export Web Map Task).

Can you please let me know, how to resolve this.

Regards
Ganesh
0 Kudos
AllanV
by
New Contributor

Did you verify if your server is still running?. I ran into a similar issue and i had to restart the arcgis server.

0 Kudos