Batch and Mass Exporting ArcGIS MXD to PDF using ArcPy
Here is the code if someone need this,
import arcpy, sys, os, string mxdList = string.split(arcpy.GetParameterAsText(0), ";") outloc = arcpy.GetParameterAsText(1) resolution = arcpy.GetParameterAsText(2) georef_info_option = arcpy.GetParameterAsText(3) layers_attributes_option = arcpy.GetParameterAsText(4) for item in mxdList: item = item.strip('\'') mxd = arcpy.mapping.MapDocument(item) base = os.path.basename(item) base = os.path.splitext(base)[0] + ".pdf" pdf_path = os.path.join(outloc, base) # Switch to layout view for df in arcpy.mapping.ListDataFrames(mxd): if df.name == "Layers": mxd.activeView = df.name mxd.title = df.name # Export to PDF with specified parameters arcpy.mapping.ExportToPDF(mxd, pdf_path, resolution=resolution, georef_info=georef_info_option, layers_attributes=layers_attributes_option) arcpy.AddMessage(base + " has been exported to PDF")
and here is how to implement it in ArcGIS Desktop
Comments
Post a Comment