I am looking for a solution for this with no success using:

result = arcpy.mapping.ConvertWebMapToMapDocument(Web_Map_as_JSON, templateMxd)


arcpy.mapping.ExportToPDF(mxd, Output_File, georef_info=True) 

All my services are in WGS84 web mercator. My only successful export was in arcmap with all data in WGS84 and dataframe in UTM, weird.


After trial and error I had the geospatial PDF export working using:

arcpy.mapping.ExportToPDF(mxd, Output_File, image_quality="BEST" georef_info=True)

The image quality parameter is important to cut down processing time, and the georef_info does embed the spatial reference, but does not make it a GeoPDF, rather a geospatial PDF that works fine in Avenza or Adobe Reader.

An important note was setting projection of the mxd within the python code before it is exported to pdf. For some reason the WGS84 web mercator doesn't work and that what the data is in on ArcGIS Server. I used a projection for 3005 and applied that to the mxd.

df = arcpy.mapping.ListDataFrames(mxd, 'Webmap')[0]
proj = "//machine/3005.prj"
spatialRef = arcpy.SpatialReference(porj)
df.spatialReference = spatialRef

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.