AnsweredAssumed Answered

PrintTemplate Dijit stops working when I add a dynamic layer

Question asked by ionarawilson on Jan 23, 2014
Latest reply on Jan 24, 2014 by ionarawilson
I am using a printtemplate dijit that was posted on the samples page. Everything works fine, but if I add a certain layer, the print dijit does not work. Instead of showing Printout it just shows "Print" Does anybody know why this is happening? Thank you



Here is the layer that I add:

var petroFieldsMSL = new ArcGISDynamicMapServiceLayer("http://tfsgis-iisd01:6080/arcgis/rest/services/FeatureServiceStewAAreaAPoint/MapServer/");
app.map.addLayer(petroFieldsMSL);



The dijit sample
https://developers.arcgis.com/en/javascript/jssamples/widget_print_esri_request.html


/ add graphics for pools with permits // I NEED SOMETHING HERE TO CREATE A PRINT MAP, I CAN CREATE A MAP SERVIC WITH A BLANK MAP         var permitUrl = "http://tfsgis-iisd01:6080/arcgis/rest/services/FeatureServiceStewAAreaAPoint/MapServer/2";         var poolFeatureLayer = new FeatureLayer(permitUrl, {           "mode": FeatureLayer.MODE_SNAPSHOT,          visible:false         });         app.map.addLayer(poolFeatureLayer);           // get print templates from the export web map task         var printInfo = esriRequest({           "url": app.printUrl,           "content": { "f": "json" }         });         printInfo.then(handlePrintInfo, handleError);          function handlePrintInfo(resp) {           var layoutTemplate, templateNames, mapOnlyIndex, templates;            layoutTemplate = arrayUtils.filter(resp.parameters, function(param, idx) {             return param.name === "Layout_Template";           });                      if ( layoutTemplate.length == 0 ) {             console.log("print service parameters name for templates must be \"Layout_Template\"");             return;           }           templateNames = layoutTemplate[0].choiceList;            // remove the MAP_ONLY template then add it to the end of the list of templates            mapOnlyIndex = arrayUtils.indexOf(templateNames, "MAP_ONLY");           if ( mapOnlyIndex > -1 ) {             var mapOnly = templateNames.splice(mapOnlyIndex, mapOnlyIndex + 1)[0];             templateNames.push(mapOnly);           }                      // create a print template for each choice           templates = arrayUtils.map(templateNames, function(ch) {             var plate = new PrintTemplate();             plate.layout = plate.label = ch;             plate.format = "PDF";             plate.layoutOptions = {                "authorText": "Texas A&M Forest Service",                "legendLayers": [],                "titleText": "Activity Point",                "scalebarUnit": "Miles"              };             return plate;           });            // create the print dijit           app.printer = new Print({             "map": app.map,             "templates": templates,             url: app.printUrl           }, dom.byId("print_button"));           app.printer.startup();         }          function handleError(err) {           console.log("Something broke: ", err);         }      featuremapServiceSource = "http://tfsgis-iisd01:6080/arcgis/rest/services/FeatureServiceStewAAreaAPoint/FeatureServer/";         var stewardship = new esri.layers.FeatureLayer(featuremapServiceSource + "/" + 0,      {                   mode: FeatureLayer.MODE_SELECTION, id: 'stewardship',           outFields: ['*']             }); app.map.addLayers(stewardship);    var highlightSymbol = new esri.symbol.SimpleMarkerSymbol().setColor(new dojo.Color([255,255,0,.6]));            highlightSymbol.setSize(9)                stewardship.setSelectionSymbol(highlightSymbol);  // I NEED THIS TO RUN THE GP SERVICE, THIS IS TO HAVE GRAPHICS ON THE MAP  var petroFieldsMSL = new ArcGISDynamicMapServiceLayer("http://tfsgis-iisd01:6080/arcgis/rest/services/FeatureServiceStewAAreaAPoint/MapServer/");       petroFieldsMSL.setDisableClientCaching(true);   //When I add this the printing dijit stops working  app.map.addLayer(petroFieldsMSL); // So not to have another layer besides stewardship     petroFieldsMSL.setVisibleLayers([0])       dojo.connect(app.map, 'onLoad', function(map) {           initToolbar(app.map);         });


And the error I am getting in FF:



The resource from this URL is not text: http://js.arcgis.com/3.6/

Outcomes