Select to view content in your preferred language

Print Dijit not opening up new tab when job is complete

1690
2
Jump to solution
02-03-2016 11:34 AM
JordanBaumgardner
Frequent Contributor

Of course everything works great on our dev servers but when we deploy to the clients servers the resulting print job does not automatically open in a new tab. The return Json from our Dev server looks identical to the return json from the client

-- ours

  {

    "paramName": "Output_File",

    "dataType": "GPDataFile",

    "value": {

      "url": "http://machineNameDev/arcgis/rest/directories/arcgisjobs/utilities/printingtools_gpserver/j2a6ac286e..."

    }

  }

-- vs theirs

  {

    "paramName": "Output_File",

    "dataType": "GPDataFile",

    "value": {

      "url": "http://machineName/arcgis/rest/directories/arcgisjobs/abcdefg/printvectormap_gpserver/j745b8bd480aa4..."

    }

  }

I though perhaps security on the browser was not allowing popups so I added

var win = window.open("http://machineName/arcgis/rest/directories/arcgisjobs/abcdefg/printvectormap_gpserver/j745b8bd480aa4... ", '_blank');
win.focus();

and that was able to open the tab and link w/o issue.

My Code:

                var prntTemplate = new esriPrintTemplate();
                prntTemplate.layout = $('#printLayout').val();
                prntTemplate.format = $('#printFormat').val();
                prntTemplate.layoutOptions = {
                    "legendLayers": []
                };

                me.esriPrintTool = new esriPrint({
                    async: true,
                    map: mainmap,
                    "templates": prntTemplate,
                    url: me.getPrintUrl("AdvancedPrint")
                }, dojoDom.byId("hiddenPrintBtnDiv"));


                me.esriPrintTool.on("error", function (evt) {
                    me.LogError("OnPrintTool Advanced Error", evt);
                });
                me.esriPrintTool.on("print-complete", function (evt) {
                    toastr["info"]("Print Complete", "Advanced Print");
                    $('#btnAdvancedPrint').removeClass("active").val("Print");
                    me.onPrintComplete();
                });


                me.esriPrintTool.startup();
                me.esriPrintTool.hide();
                me.esriPrintTool.printMap(prntTemplate);

0 Kudos
1 Solution

Accepted Solutions
JordanBaumgardner
Frequent Contributor

Ok it's not pretty, and it opens twice on any other machine, but this is working at the clients site.

me.esriPrintTool.on("print-complete", function (results) {
  if ((results) && (results.result) && (results.result.url)) {
      var resultsWin = window.open(results.result.url, '_blank');
      resultsWin.focus();
  }

  toastr["info"]("Print Complete", "Quick Print");
  $('#btnQuickPrint').removeClass("active").val("Print");
  me.onPrintComplete();
});

View solution in original post

0 Kudos
2 Replies
JordanBaumgardner
Frequent Contributor

Ok it's not pretty, and it opens twice on any other machine, but this is working at the clients site.

me.esriPrintTool.on("print-complete", function (results) {
  if ((results) && (results.result) && (results.result.url)) {
      var resultsWin = window.open(results.result.url, '_blank');
      resultsWin.focus();
  }

  toastr["info"]("Print Complete", "Quick Print");
  $('#btnQuickPrint').removeClass("active").val("Print");
  me.onPrintComplete();
});
0 Kudos
JordanBaumgardner
Frequent Contributor

My only guess as to a cause is that, for whatever reason, the command the Ersi SDK is using to pop open that window does not work in their highly secure environment and that window.open does. Anyone have any other theories?

0 Kudos