Is there a straightforward way for a user to change the map title text when printing a map instead of having it hard coded in the layoutOptions of the PrintTemplate?
I tried the following but did not work.
HTML:
<div id="print_button"></div> Title:
<input type="text" id="mapTitle" size="5" value="title" style="height: 18px; width:200px; border: 1px solid #759DC0;" />
JS:
var MT = dom.byId("mapTitle").value
// create a print template for each choice
templates = array.map(templateNames, function (ch) {
var plate = new PrintTemplate();
plate.layout = plate.label = ch;
plate.format = "PDF";
plate.showAttribution = false;
plate.exportOptions = {
dpi: 150
};
plate.layoutOptions = {
"titleText": MT,
"scalebarUnit": "Miles"
};
return plate;
});
// create the print dijit
printer = new Print({
"map": map,
"templates": templates,
url: printUrl
}, dom.byId("print_button"));
printer.startup();
}Any help is very much appreciated.