PrintTask not working

Discussion created by dugtoni on Oct 24, 2013
Latest reply on Oct 29, 2013 by schlot
I am trying to print out a pdf of my web map, with a legend, scale bar, ect.  It seems like the PrintTask was the best way to do this.  For some reason my code is failing.  Here is where the button is created to run the PrintTask:

<br><button dojoType="dijit.form.Button"  onClick="PrintMap();">Print Map</button>

and here is the function where I am trying to print the map:

var printUrl= 'https://inside-dev2.nkn.uidaho.edu:6080/arcgis/rest/services/Utilities/PrintingTools/GPServer/Export%20Web%20Map%20Task';

     function PrintMap(){

var printTask = new esri.tasks.PrintTask(printUrl);  
var params = new esri.tasks.PrintParameters();
var template = new esri.tasks.PrintTemplate();
params.map = map; 
template.layout= "A3 Landscape"
template.format= "PDF";
template.preserveScale = false;
params.template = template;

printTask.execute(params, printResult, printError)

function printResult(result){
    function printError(result){

I seem to be going to the error function every time.  Can anyone pick up anything that is wrong with my code?  Thank you!