Hi,
We try to find way to create a file with specific name ("Test123.pdf") using additional service for printing on ArcGIS Server.
ArcGIS Server 10.4
Any help will be greatly appreciated.
I don't think that parameter option is available. See the Export Web Map specifications and use the object model provided to add extra parameters.
I must admit, I played around with the export web map script and I could not get the GP service to save the file in the GP service's output folder, but it worked great if you specify another "managed" output folder on the server. E.g:
<SPAN class="keyword token">import</SPAN> arcpy arcpy<SPAN class="punctuation token">.</SPAN>env<SPAN class="punctuation token">.</SPAN>workspace <SPAN class="operator token">=</SPAN> r<SPAN class="string token">"\\gis-server\print\outputs"</SPAN> json <SPAN class="operator token">=</SPAN> arcpy<SPAN class="punctuation token">.</SPAN>GetParameter<SPAN class="punctuation token">(</SPAN><SPAN class="number token">0</SPAN><SPAN class="punctuation token">)</SPAN> name <SPAN class="operator token">=</SPAN> arcpy<SPAN class="punctuation token">.</SPAN>GetParameterAsText<SPAN class="punctuation token">(</SPAN><SPAN class="number token">1</SPAN><SPAN class="punctuation token">)</SPAN> arcpy<SPAN class="punctuation token">.</SPAN>ExportWebMap_server<SPAN class="punctuation token">(</SPAN>json<SPAN class="punctuation token">,</SPAN> name<SPAN class="punctuation token">,</SPAN> <SPAN class="string token">"PDF"</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="string token">""</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="string token">"MAP_ONLY"</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="line-numbers-rows"><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN></SPAN>
Can we call this script from Javascript on the client?
It is definitely possible if you generate the map with arcpy e.g.
arcpy<SPAN class="punctuation token">.</SPAN>ExportWebMap_server<SPAN class="punctuation token">(</SPAN>webmapjsonstring<SPAN class="punctuation token">,</SPAN><SPAN class="string token">"TEST.PDF"</SPAN><SPAN class="punctuation token">,</SPAN><SPAN class="string token">"PDF"</SPAN><SPAN class="punctuation token">,</SPAN><SPAN class="string token">""</SPAN><SPAN class="punctuation token">,</SPAN><SPAN class="string token">"MAP_ONLY"</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="line-numbers-rows"><SPAN></SPAN></SPAN>
So maybe you can create your own ExportWebMap GP tool from a script and specify the output filename as an input parameter
Thank you for your response, FC Basson.
We want the service saves the file on the server in directory
C:\arcgisserver\directories\arcgisjobs\OUR_EXPORT_SERVICENAME\Test123.pdf
Currently,
it saves in random directory with random name:
C:\arcgisserver\directories\arcgisjobs\OUR_EXPORT_SERVICENAME\jfcaa84301209481aaacf4b7aba400719\scratch\random_name.pdf
Do you want the file to be stored with that filename in the service directory or should the file be named like that for download for the user?
Angemeldete Mitglieder können Beiträge verfassen, Updates folgen und mehr. Neu hier? Registriere ein kostenloses Konto.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.