<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: PrintTask not working in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/printtask-not-working/m-p/617057#M57679</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;When I've used PrintTask, it was using locally hosted services, not AGO, so my experience might not apply.&amp;nbsp; Past experience in general tells me that there's lot of situations where you end up needing a proxy page.&amp;nbsp; It's not just for security, but any time you are trying to pass too many characters in a request, that's a circumstance that requires a proxy page too.&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;From the help:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-style:italic;"&gt; A proxy page is necessary in the following situations:&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; The application creates requests that exceed 2048 characters. While there is no official maximum length for a URL some modern browsers have imposed limits. Using a proxy works around this issue by performing a POST request rather than a GET request. POST requests are not limited by the 2048 character maximum because the information is transferred in the header instead of the URL. Common situations where you may exceed the URL length are:&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Buffer complex polygons then use the buffered geometry with a query task.&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Specify a spatial reference using well-known text (wkt).&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; The application uses a service that is secured with token-based authentication , and you do not wish to allow users to view the token, or you do not want to transmit the token over the network between your Web server and your users.&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; The application edits features in a feature service, unless the application is on the same domain as the GIS Server.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 29 Oct 2013 16:08:36 GMT</pubDate>
    <dc:creator>TracySchloss</dc:creator>
    <dc:date>2013-10-29T16:08:36Z</dc:date>
    <item>
      <title>PrintTask not working</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/printtask-not-working/m-p/617050#M57672</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I am trying to print out a pdf of my web map, with a legend, scale bar, ect.&amp;nbsp; It seems like the PrintTask was the best way to do this.&amp;nbsp; For some reason my code is failing.&amp;nbsp; Here is where the button is created to run the PrintTask:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;&amp;lt;br&amp;gt;&amp;lt;button dojoType="dijit.form.Button"&amp;nbsp; onClick="PrintMap();"&amp;gt;Print Map&amp;lt;/button&amp;gt;&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;and here is the function where I am trying to print the map:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;var printUrl= 'https://inside-dev2.nkn.uidaho.edu:6080/arcgis/rest/services/Utilities/PrintingTools/GPServer/Export%20Web%20Map%20Task';

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; function PrintMap(){

var printTask = new esri.tasks.PrintTask(printUrl);&amp;nbsp; 
var params = new esri.tasks.PrintParameters();
var template = new esri.tasks.PrintTemplate();
params.map = map; 
template.layout= "A3 Landscape"
template.format= "PDF";
template.preserveScale = false;
params.template = template;

printTask.execute(params, printResult, printError)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 

&amp;nbsp;&amp;nbsp;&amp;nbsp; }
function printResult(result){
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; console.log(result.url)
&amp;nbsp;&amp;nbsp;&amp;nbsp; }
&amp;nbsp;&amp;nbsp;&amp;nbsp; function printError(result){
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; console.log(result);
&amp;nbsp;&amp;nbsp;&amp;nbsp; }
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I seem to be going to the error function every time.&amp;nbsp; Can anyone pick up anything that is wrong with my code?&amp;nbsp; Thank you!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 24 Oct 2013 16:09:23 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/printtask-not-working/m-p/617050#M57672</guid>
      <dc:creator>StephenFricke</dc:creator>
      <dc:date>2013-10-24T16:09:23Z</dc:date>
    </item>
    <item>
      <title>Re: PrintTask not working</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/printtask-not-working/m-p/617051#M57673</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;&lt;SPAN&gt;As a follow up to this, when I change the printURL to "&lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="http://sampleserver6.arcgisonline.com/arcgis/rest/services/Utilities/PrintingTools/GPServer/Export" rel="nofollow" target="_blank"&gt;http://sampleserver6.arcgisonline.com/arcgis/rest/services/Utilities/PrintingTools/GPServer/Export&lt;/A&gt;&lt;SPAN&gt; Web Map Task", I am able to open a print page with just the basemap, but when I add any map service layers to the map, the printTask does not work.&amp;nbsp; Is this an issue with the map services being located on a separate server from the ArcGIS server, and I need a proxy page in order to solve this issue?&amp;nbsp; I used one of the map services off of arcgisonline, "&lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="http://sampleserver6.arcgisonline.com/arcgis/rest/services/SampleWorldCities/MapServer" rel="nofollow" target="_blank"&gt;http://sampleserver6.arcgisonline.com/arcgis/rest/services/SampleWorldCities/MapServer&lt;/A&gt;&lt;SPAN&gt;", and when I added this to my map the printTask worked fine, so I am almost sure that it has to do with permissions to access my map services.&amp;nbsp; Any advice?&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 25 Oct 2013 19:09:07 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/printtask-not-working/m-p/617051#M57673</guid>
      <dc:creator>StephenFricke</dc:creator>
      <dc:date>2013-10-25T19:09:07Z</dc:date>
    </item>
    <item>
      <title>Re: PrintTask not working</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/printtask-not-working/m-p/617052#M57674</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;as far as i know, to use the print task all your services must be publicly accessable&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 25 Oct 2013 19:40:44 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/printtask-not-working/m-p/617052#M57674</guid>
      <dc:creator>JeffPace</dc:creator>
      <dc:date>2013-10-25T19:40:44Z</dc:date>
    </item>
    <item>
      <title>Re: PrintTask not working</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/printtask-not-working/m-p/617053#M57675</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;as far as i know, to use the print task all your services must be publicly accessable&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;The security setting for my map services are "public, available to everyone".&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 25 Oct 2013 20:16:35 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/printtask-not-working/m-p/617053#M57675</guid>
      <dc:creator>StephenFricke</dc:creator>
      <dc:date>2013-10-25T20:16:35Z</dc:date>
    </item>
    <item>
      <title>Re: PrintTask not working</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/printtask-not-working/m-p/617054#M57676</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;One of the things I had to do to get mine to work was to use proxy pages, and then include the serverUrl in it where my printService was being hosted.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 28 Oct 2013 20:15:28 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/printtask-not-working/m-p/617054#M57676</guid>
      <dc:creator>TracySchloss</dc:creator>
      <dc:date>2013-10-28T20:15:28Z</dc:date>
    </item>
    <item>
      <title>Re: PrintTask not working</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/printtask-not-working/m-p/617055#M57677</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I would suggest watching the network traffic using developer tools in Chrome or Firebug in Firefox browser, and look for console error messages. Also, watch the request that sent out and look if it throws an error message in the response.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 28 Oct 2013 23:27:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/printtask-not-working/m-p/617055#M57677</guid>
      <dc:creator>SubaKrishnan</dc:creator>
      <dc:date>2013-10-28T23:27:09Z</dc:date>
    </item>
    <item>
      <title>Re: PrintTask not working</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/printtask-not-working/m-p/617056#M57678</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;I would suggest watching the network traffic using developer tools in Chrome or Firebug in Firefox browser, and look for console error messages. Also, watch the request that sent out and look if it throws an error message in the response.&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Thank you for the response.&amp;nbsp; When I use the PrintTask with one of my map service layers in the map, I get some errors in the console box which say, "Error {code: 400, message: "Unable to complete operation.", details: Array[1], log: undefined, _ssl: undefined}".&amp;nbsp; Do you think this confirms the fact that I need a proxy page or might there be something else going on?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 29 Oct 2013 16:00:46 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/printtask-not-working/m-p/617056#M57678</guid>
      <dc:creator>StephenFricke</dc:creator>
      <dc:date>2013-10-29T16:00:46Z</dc:date>
    </item>
    <item>
      <title>Re: PrintTask not working</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/printtask-not-working/m-p/617057#M57679</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;When I've used PrintTask, it was using locally hosted services, not AGO, so my experience might not apply.&amp;nbsp; Past experience in general tells me that there's lot of situations where you end up needing a proxy page.&amp;nbsp; It's not just for security, but any time you are trying to pass too many characters in a request, that's a circumstance that requires a proxy page too.&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;From the help:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-style:italic;"&gt; A proxy page is necessary in the following situations:&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; The application creates requests that exceed 2048 characters. While there is no official maximum length for a URL some modern browsers have imposed limits. Using a proxy works around this issue by performing a POST request rather than a GET request. POST requests are not limited by the 2048 character maximum because the information is transferred in the header instead of the URL. Common situations where you may exceed the URL length are:&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Buffer complex polygons then use the buffered geometry with a query task.&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Specify a spatial reference using well-known text (wkt).&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; The application uses a service that is secured with token-based authentication , and you do not wish to allow users to view the token, or you do not want to transmit the token over the network between your Web server and your users.&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; The application edits features in a feature service, unless the application is on the same domain as the GIS Server.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 29 Oct 2013 16:08:36 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/printtask-not-working/m-p/617057#M57679</guid>
      <dc:creator>TracySchloss</dc:creator>
      <dc:date>2013-10-29T16:08:36Z</dc:date>
    </item>
  </channel>
</rss>

