I'm 2 days into the ArcGIS JavaScript API. Can someone help me understand why my print template settings aren't being acknowledged in the code below? Thanks!
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <meta name="viewport" content="initial-scale=1, maximum-scale=1,user-scalable=no"> <title></title> <link rel="stylesheet" href="http://js.arcgis.com/3.14/dijit/themes/nihilo/nihilo.css"> <link rel="stylesheet" href="http://js.arcgis.com/3.14/esri/css/esri.css"> <style> #map{ width:640px; height:640px; } .esriAttribution{ visibility: hidden; } .logo-med{ visibility: hidden; } </style> <script src="http://js.arcgis.com/3.14/"></script> <script> require([ "esri/map", "esri/tasks/PrintTemplate", "esri/tasks/PrintParameters", "esri/dijit/Print", "dojo/dom"], function(Map, PrintTemplate, PrintParameters, Print, dom) { var map = new Map( "map",{basemap: "streets",center: [-95.993, 36.154],zoom: 12,slider: false} ); // esriConfig.defaults.io.proxyUrl = "/proxy/"; var template = new PrintTemplate(); template.exportOptions = { width: 640, height: 640, dpi: 96 }; template.format = "PNG"; template.layout = "A3 Landscape"; template.preserveScale = true; var params = new PrintParameters(); params.map = map; params.template = template; printer = new Print({ map: map, template: template, url: "http://sampleserver6.arcgisonline.com/arcgis/rest/services/Utilities/PrintingTools/GPServer/Export%2..." }, dom.byId("printButton")); printer.startup(); alert(JSON.stringify(template.exportOptions)); }); </script> </head> <body> <div id="map"></div> <div id="printButton"></div> </body> </html>
Solved! Go to Solution.
Try wrapping it in setExtent, like this jsfiddle example:
I confirmed, the size change works in this example (the URL is in the console log, FYI).
Try wrapping it in setExtent, like this jsfiddle example:
I confirmed, the size change works in this example (the URL is in the console log, FYI).
works like a charm! thank you so much!