Hi all, I am working with this sample https://developers.arcgis.com/en/javascript/jssamples/widget_print.html But unable to get the print widget working when i add graphics(I am trying to present the search results as a graphic layer) or the operational layers to the map. it works only if arcgisonline services are being used.
adding graphics quickly increases the size of the request because each geometry must be articulated to ArcGIS Server.
this means, that you'll have to follow the pattern in the original published sample and reference a working proxy so that it can be utilized in scenarios when the size of the request requires that it be POSTed across domains.
i have added the proxy page(configured to local map service) in code (i.e. esri.config.defaults.io.proxyUrl = "http://localhost/proxy/proxy.ashx";) and used the local map service, the print button itself not working but it shows map with graphics in chrome without adding the proxy page, I hope it is not the issue with the proxyUrl.
the proxy is not needed to display the graphics in the client application in chrome, so if the print button doesn't appear, its likely either that you have referenced the proxy incorrectly, or that the proxy is not functioning.
i recommend inspecting the web traffic generated by your app using something like fiddler, firebug, or chrome developer tools to try and find the request which attempts to use the proxy, along with testing the proxy directly in the browser to make sure its working.
a url similar to the following will display the REST services directory in your browser if the proxy is up and running.
Then I have downloaded the proxy.jsp into my wwwroot folder for my web application as well as attaching my url, but there is still no printing involved:
since you are using IIS, i would recommend utilizing our ASP.NET proxy. you should be able to simply unzip the contents of the ZIP file and using IIS Manager to 'convert to application'.
the included proxy.config file has a global mustMatch tag which could be set to 'false' to allow any page to be retrieved, but in a production environment it would be more secure to explicitly add resources to the list (and keep the global mustMatch tag set to 'true') to avoid malicious usage.
Here is where i've attached my local host script, see below: function init() { map = new esri.Map("map", { basemap: "streets", center: [-98.49946448681641, 29.42057087899471], zoom: 11, sliderStyle:"big" }); esri.config.defaults.io.proxyUrl = "/localhost/proxy/proxy.ashx";
what is the error message? did you use IIS manager to convert the folder the proxy is in to an application (as mentioned in my last post and install instructions)? what happens when you try to use the proxy to display the rest services directory on sampleserver6 directly in the browser?