var template = [{ label : "Portrait", format : "PDF", layout : "A4 Portrait", exportOptions : { width : 200, height : 200, dpi : 300 }, layoutOptions : { titleText : mapTitle, authorText : " ", copyrightText : "Coldwell Banker Commercial", scalebarUnit : "Miles", }, }, { label : "Landscape", format : "PDF", layout : "A4 Landscape", exportOptions : { width : 200, height : 200, dpi : 300 }, layoutOptions : { titleText : mapTitle, authorText : " ", copyrightText : "Coldwell Banker Commercial", scalebarUnit : "Miles", } }]; // print dijit app.printer = new esri.dijit.Print({ map : app.map, templates : template, url : "http://2501s-jjohnson:6080/arcgis/rest/services/Utilities/PrintingTools/GPServer/Export%20Web%20Map%20Task" }, dojo.byId("btn")); app.printer.startup(); dojo.connect(app.printer, 'onPrintStart', function() { mapTitle = prompt("What would you like to title this map?"); });
Solved! Go to Solution.
dojo.connect(print, "onPrintStart", function(){ this.templates[0].layoutOptions.titleText = "Hello Map"; });
What did you see as the title ?
dojo.connect(print, "onPrintStart", function(){ this.templates[0].layoutOptions.titleText = "Hello Map"; });
Please try this:dojo.connect(print, "onPrintStart", function(){ this.templates[0].layoutOptions.titleText = "Hello Map"; });
The array index number is the one in your templates which has the titleText. In your case, just put 0 there since you only have one template.
Hope this helps.