Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
<!DOCTYPE html>
<title>Create a Map</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="viewport" content="initial-scale=1, maximum-scale=1,user-scalable=no">
<link rel="stylesheet" href="">
<link rel="stylesheet" href="">
height: 480px;
width: 640px;
<script src=""></script>
require(["esri/map", "esri/dijit/Print", "esri/tasks/PrintTemplate"],
function(Map, Print, PrintTemplate) {
var map = new Map("mapDiv", {
center: [14.049, 55.485],
zoom: 3,
basemap: "streets",
logo: false
// configure the print task
// see here for more info:
var t = new PrintTemplate();
t.layout = "Letter ANSI A Portrait";
t.label = "Portrait (Image)";
t.format = "jpg";
t.layoutOptions = {
legendLayers: [],
scaleBarUnit: "Meters",
titleText: "Demo Title",
authorText: "author text",
copyrightText: "copyright text",
t.exportOptions = {
width: 640,
height: 480,
dpi: 96
// including only one element into the template array
// will render out only a button, it will otherwise be
// a dropdown selectbox.
var templates = [];
// Print-widget from the Dojo Toolkit
// see here for more info:
printer = new Print({
map: map,
templates: templates,
url: ""
}, dojo.byId("printButton"));
// listeners - added in ArcGis version 3.6
printer.on('print-complete', function(evt){;
console.log('The url to the print image is : ' + evt.result.url);
printer.on('print-start', function(){
console.log('The print operation has started');
printer.on('error', function(error){
console.log('The print operation has failed: ' + error);
// render the widget gui
<div id="printButton"></div>
<div id="claro">
<div id="mapDiv"></div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment