Is This Content Helpful?
We're glad to know this article was helpful.
Instructions provided describe how to export multiple map documents (.mxd) to PDF using a Python script.
The following code sample accesses a workspace, creates a list of existing .mxd files in the workspace, iterates through each .mxd, and exports to PDF.
import arcpy, os
arcpy.env.workspace = ws = r"C:\\My_Folder"
mxd_list = arcpy.ListFiles("*.mxd")
for mxd in mxd_list:
current_mxd = arcpy.mapping.MapDocument(os.path.join(ws, mxd))
pdf_name = mxd[:-4] + ".pdf"
To set the desired resolution, width, and height, insert the following variables after setting the workspace, and insert the new parameters into the ExportToPDF function.
resolution = "600"
width = 640
height = 480
arcpy.mapping.ExportToPDF(current_mxd, pdf_name, resolution, width, height)
The code can also be used as a standalone Python script. This enables users to convert multiple MXD files without opening ArcMap.