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.
Solved! Go to Solution.
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:
import arcpy
arcpy.env.workspace = r"\\gis-server\print\outputs"
json = arcpy.GetParameter(0)
name = arcpy.GetParameterAsText(1)
arcpy.ExportWebMap_server(json, name, "PDF", "", "MAP_ONLY")
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?
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
It is definitely possible if you generate the map with arcpy e.g.
arcpy.ExportWebMap_server(webmapjsonstring,"TEST.PDF","PDF","","MAP_ONLY")
So maybe you can create your own ExportWebMap GP tool from a script and specify the output filename as an input parameter
Can we call this script from Javascript on the client?
Yes, like a normal geoprocessing service. You must obviously create and publish the script tool and you can set all the map options on the client side and just pass them as input parameters for the GP service.
Thank you, FC Basson.
We already have a geoprocessing service, we can see the parameter "Output_File" in the ArcGIS REST Services Directory page for the print service.
How to use it? Do we use "extraParameters"?
PrintParameters | API Reference | ArcGIS API for JavaScript 3.19
We tried to use it like
params.extraParameters = [{ "Output_File": "Test123.pdf"}];
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:
import arcpy
arcpy.env.workspace = r"\\gis-server\print\outputs"
json = arcpy.GetParameter(0)
name = arcpy.GetParameterAsText(1)
arcpy.ExportWebMap_server(json, name, "PDF", "", "MAP_ONLY")
Thank you, FC Basson.