ESRI Print Sample not working on my machine (see link and screenshot)

1651
15
07-14-2013 03:06 PM
IanPeebles
Occasional Contributor III
I am trying to incorporate the following sample in my application:

http://developers.arcgis.com/en/javascript/samples/widget_print_esri_request/

Notice that the print button is present in the ESRI sample.

When I download the sample to my machine, the print button goes away.  Does this sample require the use of a proxy page?  The code has not been modified, just trying to run it on my local machine.  The screenshot below shows the print button missing.

How can I get this sample to work on my local machine?
0 Kudos
15 Replies
IanPeebles
Occasional Contributor III
I forgot to add. . I am not using any secure services.
0 Kudos
IanPeebles
Occasional Contributor III
Now I am trying to see if I can get the button to fire as a function.  Here is the code:

From the sample:

Code Block:

app.printer = new esri.dijit.Print({
   "map": app.map,
   "templates": templates,
   url: app.printUrl
  }, dojo.byId("print_button"));
  app.printer.startup();
}

Button Defined in the DIV:

              Note:  This sample uses an ArcGIS Server version 10.1 export web map task.
            </div>
           
            <!-- that will be used for the print dijit -->
            <!--<div id="print_button"></div>-->
     <button id="print_button" dojoType="dijit.form.Button">Print Map</button>

I have been able to get the button, but cannot get it to fire:
0 Kudos
MustafaOgurlu
New Contributor II
You can not create a button and fire the print event. As you can see;

<!--<div id="print_button"></div>-->

Its creates print button automatically, into the div element.
0 Kudos
IanPeebles
Occasional Contributor III
So why cannot I not see the button when I download the sample (without any modifications to the ESRI sample) on to my machine?  That is what I am trying to figure out.
0 Kudos
JohnGravois
Frequent Contributor
the proxy referenced in the app is required to create the button.
0 Kudos
IanPeebles
Occasional Contributor III
the proxy referenced in the app is required to create the button.


So I will need to configure a proxy page?
0 Kudos
JohnGravois
Frequent Contributor
yes.  a proxy is required.
0 Kudos
IanPeebles
Occasional Contributor III
the proxy referenced in the app is required to create the button.


OK. . I configured a proxy page.  The following lines of code are used in the proxy.ashx file:

<serverUrl url="http://<machinename>/arcgis/rest"
                   matchAll="true"></serverUrl>

File was saved.

I then went to a web browser and type in the following URL:

http://<machinename>/Proxy/proxy.ashx?http://<machinename>/arcgis/rest

The directory of REST services appears.  When I remove the code from the proxy.ashx file, I can no longer access the services through REST.  This works as it should.

In the print application, I made the following changes

app.printUrl = "http://<machinename>/arcgis/rest/services/Printing/BuildingInspections85X11L/GPServer/Export%20Web%20Map";

      function init() {
        esri.config.defaults.io.proxyUrl = "http://<machinename>/Proxy/proxy.ashx";


Still. . the print button is not showing up.  What is it that I am missing?
0 Kudos
JohnGravois
Frequent Contributor
i'm not sure.  what does the web traffic look like?  do you see any failed/garbled requests to the print service?
0 Kudos