AnsweredAssumed Answered

Using Geoprocessor for printing

Question asked by IsraAlhamood on Apr 29, 2016
Latest reply on May 3, 2016 by IsraAlhamood

Hello,

 

I'm trying to implement a print widget in my application using a geoprocessor

 

 

I have a print button. every time it's clicked it should go to this function

 

 

         function print() {

 

            gp = new Geoprocessor('url');

            var Web_Map_as_JSON =  "";

            params2 = { "Web_Map_as_JSON": Web_Map_as_JSON, "Format": "PDF" };

            gp.submitJob(params2, printResult);

         

        }

           

        function printResult(jobInfo) {

         

            gp.getResultData(jobInfo.jobId, "Output_File", displayResult);

          

           

        }

         function displayResult(results, messages) {

          

            window.open(results.value.url, "_blank");

            alert(messages);

        }

 

The problem is that one of the parameters Web_Map_as_JSON should have the map Json string. Is there any function in javascript that can have the Json string of the map?. I tried to do it manually but I get an empty map PDF or an error page.

Outcomes