If a parameter wants the MXD you need to create an MXD object with the "CURRENT" path so that the print functions know that you want to use the MXD that is open at the moment. The print could be sent to either a printer or to PDF depending on what you want to happen. I havnt written anything like this for a service but it isnt complicated to do from the desktop environment.
import sys, arcpy arcpy.env.overWriteOutput = True mxdTemplate = "CURRENT" #or a different mxd outWs = "D:\\GIS Data\\arcgisserver\\arcgisoutput" #can really be any directory outFileName = "print_service_output.pdf" ext = arcpy.Extent(-96.597, 34.742, -96.225, 35.055) outFilePath = outWs + "\\" + outFileName mxdTemplateObject = arcpy.mapping.MapDocument(mxdTemplate) df = arcpy.mapping.ListDataFrames(mxdTemplateObject)[0] df.extent = ext arcpy.mapping.ExportToPDF(mxdTemplateObject, outFilePath)
Signed in members can post, follow updates, and more. New here? Register a free account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.