Solved! Go to Solution.
the templates parameter in the print widget is an array of template.
The correct syntax for assigning values to a variable is
var template = [{
label: "Map it",
format: "GIF",
layout: "A4 Portrait",
exportOptions: {
width: 200,
height: 200,
dpi: 96 }
}];