AnsweredAssumed Answered

Print Task doesn't bring any result back

Question asked by IsraAlhamood on May 3, 2016
Latest reply on May 4, 2016 by jacobsj

Hello everyone,

I'm trying to have a print widget in my application. I'm using PrintTask.  here's the code:

 

  var template = new PrintTemplate();

            template.exportOptions = {

                width: 500,

                height: 400,

                dpi: 96

            };

 

            template.format = "PDF";

            template.layout = "MAP_ONLY";

            template.preserveScale = false;

 

            params = new PrintParameters();

            params.map = map;

            params.template = template;

            params.outSpatialReference = map.spatialReference;

         

            printTask = new PrintTask('url', { async: true });

 

And then whenever the user clicks on the print button it will go to the following function

function print() {

 

            printTask.execute(params, printResult, printError);

         

        }

           

      

function printResult(result) {

 

          

 

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

 

 

        }

 

        function printError(result) {

 

 

            alert(result);

        }

 

When I run the application and click on print, it doesn't do anything(doesn't bring an error either)

anyone can help please? I would really appreciate it.

Outcomes