esri.digit.print

1099
5
Jump to solution
08-23-2012 09:21 AM
p_thibault
New Contributor
I can not seem to get my print to recognise a template.

In the INIT function I have:

printer = new esri.dijit.Print({  
map: map, 
templates: template,
url: "http://gistest2:6080/arcgis/rest/services/Utilities/PrintingTools/GPServer/Export%20Web%20Map%20Task"
},  dojo.byId("printButton"));   
printer.startup();

This work well, except for the template.  I defined the template variable in the init function, before the printer as:

var template = new esri.tasks.PrintTemplate();
template: [{    
label: "Map it",    
format: "GIF",    
layout: "A4 Portrait",    
  exportOptions: {      
  width: 200,     
  height: 200,      
  dpi: 96 } 

}];


I get a map, but none of the template formating is seen.
0 Kudos
1 Solution

Accepted Solutions
JianHuang
Occasional Contributor III
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 }
}];

View solution in original post

0 Kudos
5 Replies
p_thibault
New Contributor
Another way to ask the above question is... how does one get the Print digit to recognize a template?


template = new esri.tasks.PrintTemplate();  
template.exportOptions = {     width: 500,     height: 400,     dpi: 96   };  
template.format = "PDF";  
template.layout = "MAP_ONLY";  
template.preserveScale = false;

printer = new esri.dijit.Print({  
"map": map,
"templates":template,
url: "http://gistest2:6080/arcgis/rest/services/Utilities/PrintingTools/GPServer/Export%20Web%20Map%20Task"
},  dojo.byId("printButton"));   
printer.startup();
 
}   //End of Init()

I do not get a pdf.  I get the default png. as an output, with default sizes.
0 Kudos
JianHuang
Occasional Contributor III
the templates parameter in the print widget is an array of template.
0 Kudos
p_thibault
New Contributor
the templates parameter in the print widget is an array of template.


In the first example(seen below), i believe that it is defined as an array..... the dijit still does not recognize it.

templates: [{     label: "Map",     format: "PDF",     layout: "MAP_ONLY",     exportOptions: {       width: 500,       height: 400,       dpi: 96     }   }, {     label: "Layout",     format: "PDF",     layout: "A4 Portrait",     layoutOptions: {       titleText: "My Print",       authorText: "esri",       copyrightText: "My Company",       scalebarUnit: "Miles",     }   }]
0 Kudos
JianHuang
Occasional Contributor III
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 }
}];
0 Kudos
p_thibault
New Contributor
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 }
}];



THANK YOU THANK YOU AND THANKS AGAIN!  A "=" instead of a ":" !!!  I starred at this for hours and read over the ":" a hundred times and never saw it.
0 Kudos