ho0mwp

Export Web Map

Discussion created by ho0mwp on Jun 19, 2014
Latest reply on Jul 2, 2014 by infindibular
Anyone have a good example of a sample that uses the Export Web Map task but allows the users the ability to select if they want to do pdf/jpeg etc ..   Having trouble finding anything like that.

Also if I am using this service on the same web server as my arcgis server behind our firewall (big company) do I need to worry about proxy server?  I can use this service with the Flex API without having to worry about proxy server stuff.  


Getting these errors though.  Do I need to require anything.  I require - "esri/dijit/Print"
LOG: esri.config.defaults.io.proxyUrl is not set.
LOG: Error: esri.config.defaults.io.proxyUrl is not set.
Error: esri.config.defaults.io.proxyUrl is not set. 
SCRIPT5022: No region setting for fpMeasurement


I thought this would work:


function Print(){
alert("Found Printing Start");
   var printUrl = "http://myserver:6080/arcgis/rest/services/Utilities/PrintingTools/GPServer/Export%20Web%20Map%20Task";

//REST URL:  http://myserver:6080/arcgis/rest/services/Utilities/PrintingTools/GPServer
//SOAP URL:  http://myserver:6080/arcgis/services/Utilities/PrintingTools/GPServer

        //Set up print stuff
        var printTask = new esri.tasks.PrintTask(printUrl);
        var params = new esri.tasks.PrintParameters();
        var template = new esri.tasks.PrintTemplate();

        params.map = map;
 

alert("Found Mark 1");

 template.exportOptions = {
            width: 595,
            height: 842,
            dpi: 96
        };
  template.format = "PDF"
        template.layout = "Letter ANSI A Landscape";
        template.preserveScale = false;

alert("Found Mark 2");
        params.template = template;

alert("Found Mark 3");
        //dojo.connect(map, "onLoad", function() {//Fire the print task
        printTask.execute(params, printResult, printError);
        setTimeout(function(){printTask.execute(params, printResult, printError);},2500);
alert("Found Mark 4");
}; 
 
    function printResult(result){
        console.log(result.url)
    }
    function printError(result){
        console.log(result);
    }

Outcomes