Problem opening PDF created with secure data and print services

2092
0
10-21-2014 09:56 AM
TracySchloss
Frequent Contributor

I know there are several threads out there for printing secure services, but I haven't found one yet that describes what I'm experiencing.  I have a created a secure print service following the instructions in the help.  We have secured it.  In the code, there is a call to that services as

    var printTask = new esri.tasks.PrintTask(printServiceUrl,printParams);

    deferred = printTask.execute(printParams);

       deferred.addCallback(function (response){

        var d = new Date();

        var dateTime =  d.getTime();

        var outputUrl = response.url + '?time=' + dateTime; 

        status.innerHTML = "";      

        var select = dijit.byId("templateSelect");

        var selectOptions = select.getOptions();

        select.set("value", "Choose Print Format");

        window.open(outputUrl,"_blank");

        });

A PDF is getting created, we can see it in the output directory.  However we can't open it, we get an error 499, indicating that it needs a token.  If I look back through the webmap_as_JSON call to the print services, I can see the token that's generated.  If I append it as an argument to the end of my PDF that's created, then I can view the PDF.

My question is, is there a way to capture the token programmatically so I can pass it to the PDF?

Tags (3)
0 Kudos
0 Replies