Select to view content in your preferred language

export mxd to PDF and JPEG files

2985
3
04-25-2011 09:23 AM
RafiqBasaria
Emerging Contributor
Hello all. Im trying to export batches of MXDs to PDF and JPEG format in 1 script. Rather than exporting 31 maps individually, the idea is to just run a script that will export all of them for me. I am in the testing phase, and I cannot seem to get anything working. Here is what I have so far. Any help would be greatly appreciated. Thanks!!

import arcpy.mapping

arcpy.mapping.ExportToJPEG("C:/Rafiq_GIS/PYTHONTESTING/2011/2011_CountyComm/Projects/Orange/ORA_ComDist_01.mxd", "C:/Rafiq_GIS/PYTHONTESTING/2011/2011_CountyComm/Maps/Orange/JPEG/ORA_ComDist_01.jpg")
arcpy.mapping.ExportToPDF ("C:/Rafiq_GIS/PYTHONTESTING/2011/2011_CountyComm/Projects/Orange/ORA_ComDist_01.mxd", "C:/Rafiq_GIS/PYTHONTESTING/2011/2011_CountyComm/Maps/Orange/PDF/ORA_ComDist_01.pdf")
Tags (2)
0 Kudos
3 Replies
JasonScheirer
Esri Alum
Do this:

mxd = arcpy.mapping.MapDocument("C:/Rafiq_GIS/PYTHONTESTING/2011/2011_CountyComm/Projects/Orange/ORA_ComDist_01.mxd")
arcpy.mapping.ExportToJPEG(mxd, "C:/Rafiq_GIS/PYTHONTESTING/2011/2011_CountyComm/Maps/Orange/JPEG/ORA_ComDist_01.jpg")
0 Kudos
RafiqBasaria
Emerging Contributor
This seems to work perfectly. Thank you!!
0 Kudos
DimitrisPoursanidis
Deactivated User
Finally, did you find the way to export in two formats and with loop for all mxd's that are in the folder ?