AnsweredAssumed Answered

PrintTemplate: change map title dynamically?

Question asked by davidchrest on Oct 23, 2015
Latest reply on Oct 26, 2015 by davidchrest

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:

Title:  

 

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.

Outcomes