kanieski

Export multiple mxds to pdf

Discussion created by kanieski on Mar 11, 2012
Latest reply on Mar 13, 2012 by jbarrette-esristaff
Hi,
I've been slowly learning python.  Currently I'm trying to export multiple mxds into a pdf.   I've been using print statement to see where I've been going wrong and I think I've narrowed it to down to the export to pdf statement.  My print statement only prints out the first mxd in the list.  Your help would greatly be appreciated.   Thanks!!!

# for each mxd in the list, access mxd, export to temporary pdf, and append to final pdf
try:
    for mxds in mxdList:
        arcpy.mapping.MapDocument(mxds)
        print "Accessed " + mxds
        tempFile = r"C\Temp\temp.pdf"
        arcpy.mapping.ExportToPDF(mxds, tempFile)
        print "Exported to temp PDF"
        pdfDocument.appendPages(tempFile)
        print "PDF created"

   
    pdfDocument.saveAndClose()
    del pdfDocument
    del mxds

except:
    print "Did not create pdf"

Outcomes