Map Title:<input type="text" id="mapTitle" />
document.getElementById('mapTitle').value
var printer = new esri.dijit.Print({ map: map, url: "http://sampleserver6.arcgisonline.com/arcgis/rest/services/Utilities/PrintingTools/GPServer/Export%20Web%20Map%20Task", templates: [{ label: "Map Only - PDF", format: "PDF", layout: "MAP_ONLY", exportOptions: { width: 1500, height: 1400, dpi: 150 } }, { label: "PDF - Layout", format: "PDF", layout: "A4 Portrait", layoutOptions: { titleText: PASSED IN VALUE, authorText: PASSED IN VALUE, copyrightText: PASSED IN VALUE, scalebarUnit: "Miles", } },{ label: "JPG - Layout", format: "JPG", layout: "A4 Portrait", layoutOptions: { titleText: PASSED IN VALUE, authorText: PASSED IN VALUE, copyrightText: PASSED IN VALUE, scalebarUnit: "Miles", } },] }, dojo.byId("printButton")); printer.startup();
var userMapTitle = document.getElementById('mapTitle').value;
layoutOptions: { titleText: userMapTitle , authorText: PASSED IN VALUE, copyrightText: PASSED IN VALUE, scalebarUnit: "Miles", }
I am trying the same approach of passing a variable to to the print layoutOptions using setting the var = document.getElementById("**").value, but not getting it to work either. did you find a solution after you posted this question over three years ago?