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.
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?
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?
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.
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.