just to confirm; Print requires Proxy?

3978
4
02-15-2013 05:35 AM
KevinMacLeod1
Occasional Contributor III
Does the printTask dijit need a proxy to work, when creating PDFs and using templates such as in the Print With Templates Sample? http://help.arcgis.com/en/webapi/javascript/arcgis/jssamples/#sample/widget_print_esri_request

I do think it does, based on this thread and others http://forums.arcgis.com/threads/56702-Export-Web-Map-Task-Error-quot-Unable-to-connect-to-map-serve...

Just wanted to confirm I was on the right track...

I copied the Print With Templates sample to my PC and ran it, and the Print button did not appear. However, when I instantatiate a new print dijit in my code, without inserting any of that template code, it prints out a PNG image into a new window just fine, using the ESRI server's print utility at http://utility.arcgisonline.com/  (and with hosting API locally)

    var PrintWidget = new esri.dijit.Print({
        map: map,
        url: getWebData.ArcGISCOMPrintService
    }, dojo.byId("PrintDiv"));
    PrintWidget.startup();
    PrintWidget.show();


I recall seeing in the proxy docs regarding CORS that while javascript doesn't allow things across domains there is an exception for images. Is that perhaps why printing of the map as a PNG works with the ArcGISonline utility, even though we're hosting the 3.3 API locally?  I'd like to use the templates to print to PDF and include the legend, scalebar and title text. Thanks for any and all input!
0 Kudos
4 Replies
JianHuang
Occasional Contributor III
Yes, you need proxy. Please see details here:
http://forums.arcgis.com/threads/77128-Export-Web-Map-Task-Error-unable-to-connect-to-map-server-onl...
First of all, it doesn't matter where you host the JS API. What matters is where you host your web application and your print service. If both are under the same domain, proxy page is not necessary. If they are different, then it requires proxy. As simple as that.
0 Kudos
KevinMacLeod1
Occasional Contributor III
Hi Jian,

Thank you for the explanation. Just wanted to be sure I understood this.

We host the API and site local but we are referencing the ESRI server's Print Task service now.

However we are just now spinning up an instance of ArcServer 10.1 on the Amazon cloud... so.. once we do that, we won't need a proxy, right?
0 Kudos
JianHuang
Occasional Contributor III
If your web application and print service will be on the same domain, then, proxy is not necessary.
0 Kudos
deleted-user-ugCMpXci8bn5
New Contributor III
Hello,
maybe this could be another thread, but i think its relevant to this one...

We have our proxy page on a cloud server (which has ArcServer 10.1), and our web application on a development server (w/ ArcServer 10.0).  We are using JS API 3.1, hosted locally on the same development server.
I am trying to use the Print class, based on this example: https://developers.arcgis.com/en/javascript/jssamples/widget_print.html

If I add 'esri.config' to my app as an required module (as in the example), I get an error saying: " ...esri/config.js Not Found".  When I remove this line, I get an error saying "Print is not defined" and another, "403: Forbidden"...in Firebug, the URL I see along with the error is the proxy page URL, with the web host server name appended to it...

What am I doing wrong here? I hope I am being clear. Thanks, J
0 Kudos