paulhedlund

PrintTemplate showAttribution undefined

Discussion created by paulhedlund on Jun 13, 2013
Latest reply on Jun 18, 2013 by rahul.guptamcakiet
I get the following error in Chrome when trying to implement the PrintTemplate.

Uncaught TypeError: Cannot read property 'showAttribution' of undefined

I have showAttribution set to true for both my map and the print template.  Any ideas?


// create the print template
      var template = new esri.tasks.PrintTemplate();
      template.layout = dijit.byId("mapLayout").value;
      template.label = "Test";
      template.format = dijit.byId("imageType").value;
   if (dijit.byId("printLegend").checked){
    template.layoutOptions = { 
       "titleText": dijit.byId("mapTitle").value,
       "authorText": dijit.byId("printAuthor").value,
       "copyrightText": dijit.byId("printCopyright").value,
       "scaleBarUnit": dijit.byId("printScale").value
     }
   }
   else {
    template.layoutOptions = { 
       "titleText": dijit.byId("mapTitle").value,
       "authorText": dijit.byId("printAuthor").value,
       "copyrightText": dijit.byId("printCopyright").value,
       "scaleBarUnit": dijit.byId("printScale").value
     }
   }
   template.preserveScale = true;
   template.showAttribution = true;
   
   //var printTaskURL = ndhx.config.printURL;
   var printTaskURL = "http://sampleserver6.arcgisonline.com/arcgis/rest/services/Utilities/PrintingTools/GPServer/Export%20Web%20Map%20Task";
   

   // var printer = new esri.dijit.Print({
     // "map": ndhx.map,
     // url: printTaskURL
   // }, dojo.byId("print_button"));
   
   ndhx.printer = new esri.dijit.Print({
       "map": ndhx.map,
       "templates": template,
       url: printTaskURL
   }, dojo.byId("print_button"));
      
   ndhx.printer.startup();
   
   dojo.connect(ndhx.printer,'onPrintStart',function(){
     console.log('The print operation has started');
   });
   
   dojo.connect(printer,'onError',function(error){
     console.log('The print operation has started');
   });
   
   dojo.connect(printer,'onPrintComplete',function(value){
     console.log('The url to the print image is : ' + value.url);
   }); 

Outcomes