How can you refresh the Print Widget?

639
4
04-02-2018 08:29 AM
JeffreyFrye
New Contributor II

I am using the esri/dijit/Print in an application. On print-complete, I have the new page automatically open in a new tab.

printer.on("print-complete", function (evt) {
    window.open(evt.result.url);
});

When user returns to original page, the print button is still displayed as "printout"

I have tried using printer.refresh(); which amazingly works, but kicks out errors in the console.

I would like the print button to return to it's printer.startup(); state after print-complete.

0 Kudos
4 Replies
AmritKumar1
New Contributor

Hi Jeffrey,

I tested out the Print sample in the samples list:

ArcGIS API for JavaScript Sandbox  

It behaves normally. When you return to the original page, it displays the print button, not the 'printout' hyperlink.

Are your working with the 3.x or 4.x API?

0 Kudos
JeffreyFrye
New Contributor II

Thanks for the quick response Amrit.

I am using 3.23. I am working internally In a development environment inside our network. I wonder If that is causing the issue? 

0 Kudos
AmritKumar1
New Contributor

Probably. Domain can be an issue. It depends on the domain on which the application is deployed and where the Export Web Map task is triggered to. To quote the documentation:

"If the URL for the Export Web Map task is from the same domain as the application the print page will be displayed in a new browser window or tab when the print button is clicked. If the URL is from a different domain, a hyperlink to the print page appears in place of the print button."

I believe, if the application and the service are from same domain, you need not specifically write out event for print-complete. It should automatically open the print result in new tab of the browser. We can check if this resolves the issue.

0 Kudos
JeffreyFrye
New Contributor II

Interesting. Both my development server (ArcGIS Server 10.5.1 with IIS installed) and the server hosting my REST Services (ArcGIS Server 10.5.1 with a webAdapter pointing to it from an IIS server) are all in the same domain in our network.

0 Kudos