Select to view content in your preferred language

PrintTask/PrintParameters bug?

1054
2
04-07-2014 09:08 PM
TimCollyer
Regular Contributor
I have a site with two cached map services and one dynamic service.

When I add my dynamic layer to my map, I call .setVisibleLayers([ ... ]) to set my desired layers. One of the layers is a group layer, the others are in the "root" level. I pass the "group" level id to .setVisibleLayers([ ... ]) for the group layer as I want all layers in that group visible.

I've created a "print" function which is called from a button onclick which executes a simple PrintTask.

function printMap() {
 require(["esri/tasks/PrintTask", "esri/tasks/PrintParameters", "esri/tasks/PrintTemplate"], 
   function(PrintTask, PrintParameters, PrintTemplate){
  
    var url = "http://gisapps/arcgis/rest/services/Utilities/PrintingTools/GPServer/Export Web Map Task";
    
    var template = new PrintTemplate();
    template.layoutOptions = {
      titleText: "Selected Work",
      legendLayers: []
      
    };
    template.format = "PDF";
    template.layout = "A4 Landscape";
    template.exportOptions = {
      width: 1024,
      height: 786,
      dpi: 96
    };


    
    var params = new PrintParameters();
    params.template = template;
    params.map = map;
    
    var printTask = new PrintTask(url);
    printTask.execute(params, function(results){
     window.open(results.url);
    });
   }
 );
}



When I execute this PrintTask, the grouped layers in my dynamic service do not appear in the output - the other layers do.

If instead of supplying the group layer id to .setVisibleLayers[ ... ]) I supply the individual layer ids, they then appear in the PrintTask output.

I'm fairly sure this is a bug, because it would seem a bit strange that supplying the group layer id to .setVisibleLayers() would result in all layers in the group becoming visible in the map, but not the output of the PrintTask.
2 Replies
AndrewThomas2
New Contributor

Hi Tim.

Did you ever get a solution to this? I am facing the same problem. This feels very much like a bug to me also.

0 Kudos
PetteriFischer
Deactivated User

I have got similar problems using Argis Runtime SDK for .NET.

When using SetFeatureVisibility(listofids, false) inside a Layer and calling PrintTask the Features don't disappear inside the (pdf, gif etc.) document.

I also tried using DefinitionExpression which has the same effect.

The features disappear on the MapView.

Looks like a bug to me.

0 Kudos